/// migrate((app) => { const collection = app.findCollectionByNameOrId("pbc_2992844423") // update collection data unmarshal({ "viewQuery": "SELECT\n (ROW_NUMBER() OVER ()) AS id,\n Dvn1.patientName AS dvn_patient,\n Dorz3.patientName AS dorz_patient\nFROM Dorz3\nLEFT OUTER JOIN Dvn1 ON Dvn1.patientName = Dorz3.patientName\nWHERE Dvn1.patientName IS NOT NULL;" }, collection) // remove field collection.fields.removeById("_clone_hsZW") // remove field collection.fields.removeById("_clone_hFPb") // add field collection.fields.addAt(1, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_wgIC", "max": 0, "min": 0, "name": "dvn_patient", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) // add field collection.fields.addAt(2, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_LFmB", "max": 0, "min": 0, "name": "dorz_patient", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) return app.save(collection) }, (app) => { const collection = app.findCollectionByNameOrId("pbc_2992844423") // update collection data unmarshal({ "viewQuery": "SELECT\n (ROW_NUMBER() OVER ()) AS id,\n Dvn1.patientName AS dvn_patient,\n Dorz3.patientName AS dorz_patient\nFROM Dorz3\nLEFT OUTER JOIN Dvn1 ON Dvn1.patientName = Dorz3.patientName\nWHERE Dvn1.patientName IS NULL;" }, collection) // add field collection.fields.addAt(1, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_hsZW", "max": 0, "min": 0, "name": "dvn_patient", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) // add field collection.fields.addAt(2, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_hFPb", "max": 0, "min": 0, "name": "dorz_patient", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) // remove field collection.fields.removeById("_clone_wgIC") // remove field collection.fields.removeById("_clone_LFmB") return app.save(collection) })