From afb3a07435ee7c3abf459686293d435fd7596415 Mon Sep 17 00:00:00 2001 From: "[dyad]" Date: Wed, 10 Sep 2025 12:37:53 +0200 Subject: [PATCH] [dyad] Adding quantity field to book_out_records collection - wrote 1 file(s) --- ...376525_add_quantity_to_book_out_records.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 pocketbase/pb_migrations/1757376525_add_quantity_to_book_out_records.js 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