24 lines
1.3 KiB
SQL
24 lines
1.3 KiB
SQL
-- +goose Up
|
|
|
|
-- Owner-toggleable business modules — separate from core's `modules` table
|
|
-- (registered external services with health checks/restart). This is an
|
|
-- internal on/off switch: when a key is disabled, its nav entries and
|
|
-- routes disappear for every staff role, same idea as a feature flag. Only
|
|
-- a fixed, known set of keys exists (enforced in code, not a CHECK
|
|
-- constraint, so adding a new toggleable module later is a Go-side change
|
|
-- plus a migration INSERT, not a constraint rewrite). "service" (orders/
|
|
-- kanban/warehouse/cash) is deliberately not one of these rows — it's the
|
|
-- one thing that's always on, so there's always a usable fallback to
|
|
-- redirect a staff member to if their current section gets disabled.
|
|
CREATE TABLE feature_modules (
|
|
key TEXT PRIMARY KEY,
|
|
enabled BOOLEAN NOT NULL DEFAULT TRUE,
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_by_staff_name TEXT
|
|
);
|
|
|
|
-- Seeded enabled=true (the default column value already covers this, but
|
|
-- explicit here) — existing installs keep every module visible exactly as
|
|
-- before this migration; nothing disappears until an owner turns it off.
|
|
INSERT INTO feature_modules (key) VALUES ('online_shop'), ('catalogs'), ('cartridges');
|