new widget types
This commit is contained in:
@@ -62,6 +62,41 @@ migrate((app) => {
|
||||
name: "half_width",
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
name: "widget_type",
|
||||
required: false,
|
||||
max: 40,
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
name: "icon_id",
|
||||
required: false,
|
||||
max: 40,
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
name: "chart_style",
|
||||
required: false,
|
||||
max: 40,
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
name: "budget_cap_mode",
|
||||
required: false,
|
||||
max: 40,
|
||||
},
|
||||
{
|
||||
type: "number",
|
||||
name: "budget_fixed_amount",
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
type: "number",
|
||||
name: "budget_average_months",
|
||||
required: false,
|
||||
onlyInt: true,
|
||||
},
|
||||
{
|
||||
type: "json",
|
||||
name: "label_ids",
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/// PocketBase migration: budget / chart / icon fields on home_filter_widgets.
|
||||
migrate((app) => {
|
||||
const col = app.findCollectionByNameOrId("home_filter_widgets");
|
||||
col.fields.add({
|
||||
type: "text",
|
||||
name: "widget_type",
|
||||
required: false,
|
||||
max: 40,
|
||||
});
|
||||
col.fields.add({
|
||||
type: "text",
|
||||
name: "icon_id",
|
||||
required: false,
|
||||
max: 40,
|
||||
});
|
||||
col.fields.add({
|
||||
type: "text",
|
||||
name: "chart_style",
|
||||
required: false,
|
||||
max: 40,
|
||||
});
|
||||
col.fields.add({
|
||||
type: "text",
|
||||
name: "budget_cap_mode",
|
||||
required: false,
|
||||
max: 40,
|
||||
});
|
||||
col.fields.add({
|
||||
type: "number",
|
||||
name: "budget_fixed_amount",
|
||||
required: false,
|
||||
});
|
||||
col.fields.add({
|
||||
type: "number",
|
||||
name: "budget_average_months",
|
||||
required: false,
|
||||
onlyInt: true,
|
||||
});
|
||||
app.save(col);
|
||||
}, (app) => {
|
||||
try {
|
||||
const col = app.findCollectionByNameOrId("home_filter_widgets");
|
||||
for (const name of [
|
||||
"widget_type",
|
||||
"icon_id",
|
||||
"chart_style",
|
||||
"budget_cap_mode",
|
||||
"budget_fixed_amount",
|
||||
"budget_average_months",
|
||||
]) {
|
||||
const field = col.fields.getByName(name);
|
||||
if (field) col.fields.remove(field);
|
||||
}
|
||||
app.save(col);
|
||||
} catch (_) {}
|
||||
});
|
||||
Reference in New Issue
Block a user