new widget types 2
This commit is contained in:
@@ -1,20 +1,22 @@
|
|||||||
/// PocketBase migration: half_width on home_filter_widgets.
|
/// PocketBase migration: half_width on home_filter_widgets.
|
||||||
///
|
///
|
||||||
/// Apply after 1740000004 if that collection already exists.
|
/// 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) => {
|
migrate((app) => {
|
||||||
const col = app.findCollectionByNameOrId("home_filter_widgets");
|
const col = app.findCollectionByNameOrId("home_filter_widgets");
|
||||||
col.fields.add({
|
if (col.fields.getByName("half_width")) return;
|
||||||
type: "bool",
|
|
||||||
|
col.fields.add(new BoolField({
|
||||||
name: "half_width",
|
name: "half_width",
|
||||||
required: false,
|
required: false,
|
||||||
});
|
}));
|
||||||
app.save(col);
|
app.save(col);
|
||||||
}, (app) => {
|
}, (app) => {
|
||||||
try {
|
try {
|
||||||
const col = app.findCollectionByNameOrId("home_filter_widgets");
|
const col = app.findCollectionByNameOrId("home_filter_widgets");
|
||||||
const field = col.fields.getByName("half_width");
|
const field = col.fields.getByName("half_width");
|
||||||
if (field) {
|
if (field) {
|
||||||
col.fields.remove(field);
|
col.fields.removeById(field.id);
|
||||||
app.save(col);
|
app.save(col);
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
|||||||
@@ -1,41 +1,49 @@
|
|||||||
/// PocketBase migration: budget / chart / icon fields on home_filter_widgets.
|
/// PocketBase migration: budget / chart / icon fields on home_filter_widgets.
|
||||||
migrate((app) => {
|
migrate((app) => {
|
||||||
const col = app.findCollectionByNameOrId("home_filter_widgets");
|
const col = app.findCollectionByNameOrId("home_filter_widgets");
|
||||||
col.fields.add({
|
|
||||||
type: "text",
|
if (!col.fields.getByName("widget_type")) {
|
||||||
name: "widget_type",
|
col.fields.add(new TextField({
|
||||||
required: false,
|
name: "widget_type",
|
||||||
max: 40,
|
required: false,
|
||||||
});
|
max: 40,
|
||||||
col.fields.add({
|
}));
|
||||||
type: "text",
|
}
|
||||||
name: "icon_id",
|
if (!col.fields.getByName("icon_id")) {
|
||||||
required: false,
|
col.fields.add(new TextField({
|
||||||
max: 40,
|
name: "icon_id",
|
||||||
});
|
required: false,
|
||||||
col.fields.add({
|
max: 40,
|
||||||
type: "text",
|
}));
|
||||||
name: "chart_style",
|
}
|
||||||
required: false,
|
if (!col.fields.getByName("chart_style")) {
|
||||||
max: 40,
|
col.fields.add(new TextField({
|
||||||
});
|
name: "chart_style",
|
||||||
col.fields.add({
|
required: false,
|
||||||
type: "text",
|
max: 40,
|
||||||
name: "budget_cap_mode",
|
}));
|
||||||
required: false,
|
}
|
||||||
max: 40,
|
if (!col.fields.getByName("budget_cap_mode")) {
|
||||||
});
|
col.fields.add(new TextField({
|
||||||
col.fields.add({
|
name: "budget_cap_mode",
|
||||||
type: "number",
|
required: false,
|
||||||
name: "budget_fixed_amount",
|
max: 40,
|
||||||
required: false,
|
}));
|
||||||
});
|
}
|
||||||
col.fields.add({
|
if (!col.fields.getByName("budget_fixed_amount")) {
|
||||||
type: "number",
|
col.fields.add(new NumberField({
|
||||||
name: "budget_average_months",
|
name: "budget_fixed_amount",
|
||||||
required: false,
|
required: false,
|
||||||
onlyInt: true,
|
}));
|
||||||
});
|
}
|
||||||
|
if (!col.fields.getByName("budget_average_months")) {
|
||||||
|
col.fields.add(new NumberField({
|
||||||
|
name: "budget_average_months",
|
||||||
|
required: false,
|
||||||
|
onlyInt: true,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
app.save(col);
|
app.save(col);
|
||||||
}, (app) => {
|
}, (app) => {
|
||||||
try {
|
try {
|
||||||
@@ -49,7 +57,7 @@ migrate((app) => {
|
|||||||
"budget_average_months",
|
"budget_average_months",
|
||||||
]) {
|
]) {
|
||||||
const field = col.fields.getByName(name);
|
const field = col.fields.getByName(name);
|
||||||
if (field) col.fields.remove(field);
|
if (field) col.fields.removeById(field.id);
|
||||||
}
|
}
|
||||||
app.save(col);
|
app.save(col);
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user