/// 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 `Dvn1`.`birthDate`,\n `Dvn1`.`policyNumber`,\n Dorz3.patientName AS dorz_patient\nFROM Dvn1\nLEFT OUTER JOIN `Dorz3` ON Dvn1.patientName = Dorz3.patientName\nWHERE Dorz3.patientName IS NULL\nGROUP by `Dvn1`.`patientName`" }, collection) // remove field collection.fields.removeById("_clone_F6Zo") // remove field collection.fields.removeById("_clone_K569") // remove field collection.fields.removeById("_clone_HhtQ") // add field collection.fields.addAt(1, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_jHnH", "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_mqQt", "max": 0, "min": 0, "name": "birthDate", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) // add field collection.fields.addAt(3, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_gWlN", "max": 0, "min": 0, "name": "policyNumber", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) // add field collection.fields.addAt(4, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_bZOc", "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 `Dvn1`.`birthDate`,\n Dorz3.patientName AS dorz_patient\nFROM Dvn1\nLEFT OUTER JOIN `Dorz3` ON Dvn1.patientName = Dorz3.patientName\nWHERE Dorz3.patientName IS NULL\nGROUP by `Dvn1`.`patientName`" }, collection) // add field collection.fields.addAt(1, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_F6Zo", "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_K569", "max": 0, "min": 0, "name": "birthDate", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) // add field collection.fields.addAt(3, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_HhtQ", "max": 0, "min": 0, "name": "dorz_patient", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) // remove field collection.fields.removeById("_clone_jHnH") // remove field collection.fields.removeById("_clone_mqQt") // remove field collection.fields.removeById("_clone_gWlN") // remove field collection.fields.removeById("_clone_bZOc") return app.save(collection) })