Files
lettersoup-online/002_source/pocketbase/pb_migrations/1745319727_updated_customers.js
2025-04-24 20:03:26 +08:00

123 lines
2.5 KiB
JavaScript

/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_108570809")
// add field
collection.fields.addAt(1, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text1579384326",
"max": 0,
"min": 0,
"name": "name",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(2, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text3885137012",
"max": 0,
"min": 0,
"name": "email",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(3, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text1146066909",
"max": 0,
"min": 0,
"name": "phone",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(4, new Field({
"hidden": false,
"id": "number1813778413",
"max": null,
"min": null,
"name": "quota",
"onlyInt": false,
"presentable": false,
"required": false,
"system": false,
"type": "number"
}))
// add field
collection.fields.addAt(5, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text2063623452",
"max": 0,
"min": 0,
"name": "status",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}))
// add field
collection.fields.addAt(6, new Field({
"hidden": false,
"id": "file507207115",
"maxSelect": 1,
"maxSize": 0,
"mimeTypes": [],
"name": "avatar_file",
"presentable": false,
"protected": false,
"required": false,
"system": false,
"thumbs": [],
"type": "file"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_108570809")
// remove field
collection.fields.removeById("text1579384326")
// remove field
collection.fields.removeById("text3885137012")
// remove field
collection.fields.removeById("text1146066909")
// remove field
collection.fields.removeById("number1813778413")
// remove field
collection.fields.removeById("text2063623452")
// remove field
collection.fields.removeById("file507207115")
return app.save(collection)
})