You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
board/pb_migrations/1760690150_updated_Sergey_P...

59 lines
1.4 KiB
JavaScript

/// <reference path="../pb_data/types.d.ts" />
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\nwhere diagnosCode = \"K86.1\"\n"
}, collection)
// remove field
collection.fields.removeById("_clone_nMPs")
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_kzd7",
"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_480415205")
// update collection data
unmarshal({
"viewQuery": "SELECT \n (ROW_NUMBER() OVER()) as id, \n doctor, count(doctor) as cnt\nfrom dorz1\n"
}, collection)
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "_clone_nMPs",
"max": 0,
"min": 0,
"name": "doctor",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}))
// remove field
collection.fields.removeById("_clone_kzd7")
return app.save(collection)
})