ar-test/pb_migrations/1791860000_project_button_style.js

17 lines
764 B
JavaScript

/// <reference path="../pocketbase/pb_data/types.d.ts" />
// Custom logo backing colour, and per-project button text colour + label
const HEX = "^#[0-9a-fA-F]{6}$";
migrate((app) => {
const projects = app.findCollectionByNameOrId("projects");
projects.fields.add(new Field({ type: "text", name: "logo_bg_color", pattern: HEX }));
projects.fields.add(new Field({ type: "text", name: "button_text_color", pattern: HEX }));
projects.fields.add(new Field({ type: "text", name: "button_label", max: 32 }));
app.save(projects);
}, (app) => {
const projects = app.findCollectionByNameOrId("projects");
for (const name of ["logo_bg_color", "button_text_color", "button_label"]) projects.fields.removeByName(name);
app.save(projects);
});