JEISA-WEBAPP/backup/1757376550_created_suppliers.js
2025-09-25 00:15:35 +02:00

114 lines
No EOL
3 KiB
JavaScript

/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = new Collection({
"id": "pbc_suppliers", // Unique ID for the suppliers collection
"name": "suppliers",
"type": "base",
"system": false,
"listRule": null,
"viewRule": null,
"createRule": null,
"updateRule": null,
"deleteRule": null,
"schema": [
{
"autogeneratePattern": "[a-z0-9]{15}",
"hidden": false,
"id": "text3208210256",
"max": 15,
"min": 15,
"name": "id",
"pattern": "^[a-z0-9]+$",
"presentable": false,
"primaryKey": true,
"required": true,
"system": true,
"type": "text"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text2474346735",
"max": 0,
"min": 0,
"name": "supplier_name", // Corrected from 'supplier_name' to 'supplier_name'
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text4003876389",
"max": 0,
"min": 0,
"name": "supplier_address", // Corrected typo from 'suppier_address'
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"exceptDomains": null,
"hidden": false,
"id": "email1049198174",
"name": "supplier_email",
"onlyDomains": null,
"presentable": false,
"required": false,
"system": false,
"type": "email"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text23603970",
"max": 0,
"min": 0,
"name": "supplier_phone_number", // Corrected from 'supplier_phone'
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"id": "supplier_created", // Unique ID for the 'created' field
"name": "created",
"type": "autodate",
"system": true,
"required": false,
"onCreate": true,
"onUpdate": false,
"presentable": false,
"hidden": false
},
{
"id": "supplier_updated", // Unique ID for the 'updated' field
"name": "updated",
"type": "autodate",
"system": true,
"required": false,
"onCreate": true,
"onUpdate": true,
"presentable": false,
"hidden": false
}
],
"indexes": [],
});
return app.save(collection);
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_suppliers");
// Revert changes if necessary, though typically migrations are forward-only.
// For simplicity, we'll just delete the collection on downgrade.
return app.delete(collection);
});