Files
lettersoup-online/002_source/pocketbase/pb_migrations/1745198654_updated_QuizLPQuestions.js
2025-04-22 02:53:49 +08:00

154 lines
3.2 KiB
JavaScript

/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_742947356")
// add field
collection.fields.addAt(4, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text1125157303",
"max": 0,
"min": 0,
"name": "cat_name",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(5, new Field({
"hidden": false,
"id": "file2034676914",
"maxSelect": 1,
"maxSize": 0,
"mimeTypes": [],
"name": "cat_image",
"presentable": false,
"protected": false,
"required": false,
"system": false,
"thumbs": [],
"type": "file"
}))
// add field
collection.fields.addAt(6, new Field({
"hidden": false,
"id": "number2161764012",
"max": null,
"min": null,
"name": "pos",
"onlyInt": false,
"presentable": false,
"required": false,
"system": false,
"type": "number"
}))
// add field
collection.fields.addAt(7, new Field({
"hidden": false,
"id": "json3915970527",
"maxSize": 0,
"name": "init_answer",
"presentable": false,
"required": false,
"system": false,
"type": "json"
}))
// add field
collection.fields.addAt(8, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text2058414169",
"max": 0,
"min": 0,
"name": "visible",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(9, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text2560465762",
"max": 0,
"min": 0,
"name": "slug",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(10, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text1156222427",
"max": 0,
"min": 0,
"name": "remarks",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(11, new Field({
"convertURLs": false,
"hidden": false,
"id": "editor1843675174",
"maxSize": 0,
"name": "description",
"presentable": false,
"required": false,
"system": false,
"type": "editor"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_742947356")
// remove field
collection.fields.removeById("text1125157303")
// remove field
collection.fields.removeById("file2034676914")
// remove field
collection.fields.removeById("number2161764012")
// remove field
collection.fields.removeById("json3915970527")
// remove field
collection.fields.removeById("text2058414169")
// remove field
collection.fields.removeById("text2560465762")
// remove field
collection.fields.removeById("text1156222427")
// remove field
collection.fields.removeById("editor1843675174")
return app.save(collection)
})