/// 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 `Dvn1` JOIN `Dorz3` on `Dvn1`.`patientName` = `Dorz3`.`patientName`\n\n \n" }, collection) // remove field collection.fields.removeById("_clone_tmv2") // remove field collection.fields.removeById("_clone_H2Zv") // add field collection.fields.addAt(1, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_r14d", "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_6zI5", "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 `Dvn1` JOIN `Dorz3` on `Dvn1`.`patientName` = `Dorz3`.`patientName`\nWHERE `Dorz3`.`patientName` ISNULL\n \n" }, collection) // add field collection.fields.addAt(1, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_tmv2", "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_H2Zv", "max": 0, "min": 0, "name": "dorz_patient", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) // remove field collection.fields.removeById("_clone_r14d") // remove field collection.fields.removeById("_clone_6zI5") return app.save(collection) })