Files
ingtrakapp/pocketbase/pb_migrations/1740000008_ingtrak_home_widgets_label_match.js

23 lines
589 B
JavaScript

/// PocketBase migration: label_match (AND/OR) on home_filter_widgets.
migrate((app) => {
const col = app.findCollectionByNameOrId("home_filter_widgets");
if (col.fields.getByName("label_match")) return;
col.fields.add(new Field({
type: "text",
name: "label_match",
required: false,
max: 16,
}));
app.save(col);
}, (app) => {
try {
const col = app.findCollectionByNameOrId("home_filter_widgets");
const field = col.fields.getByName("label_match");
if (field) {
col.fields.removeById(field.id);
app.save(col);
}
} catch (_) {}
});