migrations: добавить site_stats и поля в posts, удалить старые коллекции

This commit is contained in:
Web-serfer 2026-05-07 16:56:12 +05:00
parent e7700a3391
commit 79db7c8563
5 changed files with 381 additions and 0 deletions

View file

@ -0,0 +1,45 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_1125843985")
// add field
collection.fields.addAt(13, new Field({
"help": "",
"hidden": false,
"id": "number1269103533",
"max": null,
"min": null,
"name": "today_views",
"onlyInt": false,
"presentable": false,
"required": false,
"system": false,
"type": "number"
}))
// add field
collection.fields.addAt(14, new Field({
"help": "",
"hidden": false,
"id": "date852920662",
"max": "",
"min": "",
"name": "last_reset",
"presentable": false,
"required": false,
"system": false,
"type": "date"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_1125843985")
// remove field
collection.fields.removeById("number1269103533")
// remove field
collection.fields.removeById("date852920662")
return app.save(collection)
})