diff --git a/pocketbase/pb_migrations/1757376525_add_quantity_to_book_out_records.js b/pocketbase/pb_migrations/1757376525_add_quantity_to_book_out_records.js new file mode 100644 index 0000000..f5dbfd1 --- /dev/null +++ b/pocketbase/pb_migrations/1757376525_add_quantity_to_book_out_records.js @@ -0,0 +1,26 @@ +/// +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); +}) \ No newline at end of file