[dyad] Adding quantity field to book_out_records collection - wrote 1 file(s)

This commit is contained in:
[dyad] 2025-09-10 12:37:53 +02:00
parent 600d570d61
commit afb3a07435

View file

@ -0,0 +1,26 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_3572209852"); // ID of book_out_records
collection.schema.addField(new SchemaField({
"system": false,
"id": "field_quantity_book_out", // Unique ID for the new field
"name": "quantity",
"type": "number",
"required": true,
"presentable": false,
"unique": false,
"options": {
"min": 1,
"max": null,
"noDecimal": true
}
}));
return app.save(collection);
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_3572209852"); // ID of book_out_records
collection.schema.removeField("field_quantity_book_out"); // Remove the field on downgrade
return app.save(collection);
})