/// migrate((app) => { const collection = app.findCollectionByNameOrId("pbc_480415205") // update collection data unmarshal({ "viewQuery": "SELECT \n (ROW_NUMBER() OVER()) as id, \n doctor, count(doctor) as cnt\nfrom dorz1" }, collection) // remove field collection.fields.removeById("_clone_srCj") // add field collection.fields.addAt(1, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_1U8A", "max": 0, "min": 0, "name": "doctor", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) // add field collection.fields.addAt(2, new Field({ "hidden": false, "id": "number432430951", "max": null, "min": null, "name": "cnt", "onlyInt": false, "presentable": false, "required": false, "system": false, "type": "number" })) return app.save(collection) }, (app) => { const collection = app.findCollectionByNameOrId("pbc_480415205") // update collection data unmarshal({ "viewQuery": "SELECT \n (ROW_NUMBER() OVER()) as id,\n doctor\nFROM dorz1" }, collection) // add field collection.fields.addAt(1, new Field({ "autogeneratePattern": "", "hidden": false, "id": "_clone_srCj", "max": 0, "min": 0, "name": "doctor", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" })) // remove field collection.fields.removeById("_clone_1U8A") // remove field collection.fields.removeById("number432430951") return app.save(collection) })