Files
ingtrakapp/pocketbase/pb_migrations/1740000005_ingtrak_home_widgets_half_width.js
2026-09-10 17:37:10 +02:00

26 lines
813 B
JavaScript

/// PocketBase migration: half_width on home_filter_widgets.
///
/// Apply after 1740000004 if that collection already exists without half_width.
/// For new installs, 1740000004 already creates half_width — this is a no-op then.
migrate((app) => {
const col = app.findCollectionByNameOrId("home_filter_widgets");
if (col.fields.getByName("half_width")) return;
// Automigrate-style constructor (plain objects are rejected by fields.add).
col.fields.add(new Field({
type: "bool",
name: "half_width",
required: false,
}));
app.save(col);
}, (app) => {
try {
const col = app.findCollectionByNameOrId("home_filter_widgets");
const field = col.fields.getByName("half_width");
if (field) {
col.fields.removeById(field.id);
app.save(col);
}
} catch (_) {}
});