astro_minivan/backend/pb_migrations/1765515600_simplify_b_navbar.js

209 lines
4.7 KiB
JavaScript
Raw Permalink Normal View History

2026-03-29 17:24:16 +05:00
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_863577031");
// Remove excess fields to match t_navbar structure
// remove field: section
collection.fields.removeById("text1122334455");
// remove field: column_title
collection.fields.removeById("text2233445566");
// remove field: column_order
collection.fields.removeById("number1122334455");
// remove field: item_order
collection.fields.removeById("number2233445566");
// remove field: is_cta
collection.fields.removeById("bool1122334455");
// remove field: item_type
collection.fields.removeById("text3344556677");
// remove field: target_blank
collection.fields.removeById("bool2233445566");
// remove field: css_class
collection.fields.removeById("text4455667788");
// remove field: svg_icon
collection.fields.removeById("text5566778899");
// remove field: hover_color_class
collection.fields.removeById("text6677889900");
// remove field: icon
collection.fields.removeById("text7788990011");
return app.save(collection);
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_863577031");
// Add back all the fields that were removed in the main migration
// add field for section
collection.fields.addAt(5, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text1122334455",
"max": 0,
"min": 0,
"name": "section",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}));
// add field for column_title
collection.fields.addAt(6, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text2233445566",
"max": 0,
"min": 0,
"name": "column_title",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}));
// add field for column_order
collection.fields.addAt(7, new Field({
"hidden": false,
"id": "number1122334455",
"max": null,
"min": null,
"name": "column_order",
"onlyInt": true,
"presentable": false,
"required": false,
"system": false,
"type": "number"
}));
// add field for item_order
collection.fields.addAt(8, new Field({
"hidden": false,
"id": "number2233445566",
"max": null,
"min": null,
"name": "item_order",
"onlyInt": true,
"presentable": false,
"required": false,
"system": false,
"type": "number"
}));
// add field for is_cta
collection.fields.addAt(9, new Field({
"hidden": false,
"id": "bool1122334455",
"name": "is_cta",
"presentable": false,
"required": false,
"system": false,
"type": "bool"
}));
// add field for item_type
collection.fields.addAt(10, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text3344556677",
"max": 0,
"min": 0,
"name": "item_type",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}));
// add field for target_blank
collection.fields.addAt(11, new Field({
"hidden": false,
"id": "bool2233445566",
"name": "target_blank",
"presentable": false,
"required": false,
"system": false,
"type": "bool"
}));
// add field for css_class
collection.fields.addAt(12, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text4455667788",
"max": 0,
"min": 0,
"name": "css_class",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}));
// add field for svg_icon
collection.fields.addAt(13, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text5566778899",
"max": 0,
"min": 0,
"name": "svg_icon",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}));
// add field for hover_color_class
collection.fields.addAt(14, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text6677889900",
"max": 0,
"min": 0,
"name": "hover_color_class",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}));
// add field for icon
collection.fields.addAt(15, new Field({
"autogeneratePattern": "",
"hidden": false,
"id": "text7788990011",
"max": 0,
"min": 0,
"name": "icon",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}));
return app.save(collection);
})