/// migrate((app) => { const collection = app.findCollectionByNameOrId("pbc_3856397659") // update collection data unmarshal({ "viewQuery": "select \n (ROW_NUMBER() OVER()) as id,\n doctor, \n count(doctor) as cnt\nfrom dvn1\n where diagnosCode = \"I45.1\"\ngroup by doctor\n" }, collection) // remove field collection.fields.removeById("_clone_OhO7") // add field collection.fields.addAt(1, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_9Xsr", "max": 0, "min": 0, "name": "doctor", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) return app.save(collection) }, (app) => { const collection = app.findCollectionByNameOrId("pbc_3856397659") // update collection data unmarshal({ "viewQuery": "select \n (ROW_NUMBER() OVER()) as id,\n doctor, \n count(doctor) as cnt\nfrom dvn2\ngroup by doctor\n" }, collection) // add field collection.fields.addAt(1, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_OhO7", "max": 0, "min": 0, "name": "doctor", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) // remove field collection.fields.removeById("_clone_9Xsr") return app.save(collection) })