[dyad] Adding quantity field to book_out_records collection - wrote 1 file(s)
This commit is contained in:
parent
600d570d61
commit
afb3a07435
1 changed files with 26 additions and 0 deletions
|
|
@ -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);
|
||||
})
|
||||
Loading…
Reference in a new issue