Make local UI setup truthful and rerunnable

This commit is contained in:
master
2026-04-14 21:44:35 +03:00
parent c69ebb4c48
commit 75ccdf81c1
28 changed files with 1272 additions and 173 deletions

View File

@@ -1,20 +1,13 @@
-- Platform environment_settings table for setup state and runtime config overrides.
-- Used by SetupStateDetector to determine if setup wizard has been completed.
-- Platform environment_settings table for installation-scoped runtime config overrides.
-- Fresh compose databases should start without a SetupComplete marker so the
-- truthful bootstrap wizard can own first-run convergence.
-- This is idempotent and safe to run on new compose databases.
CREATE SCHEMA IF NOT EXISTS platform;
CREATE TABLE IF NOT EXISTS platform.environment_settings (
key VARCHAR(256) NOT NULL,
value TEXT NOT NULL,
tenant_id VARCHAR(128) NOT NULL DEFAULT '_system',
updated_by VARCHAR(256) NOT NULL DEFAULT 'system',
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (tenant_id, key)
key TEXT PRIMARY KEY,
value TEXT NOT NULL,
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_by TEXT NOT NULL DEFAULT 'system'
);
-- Mark setup as complete for fresh installs (docker-compose local dev).
-- The setup wizard can re-run and overwrite this if needed.
INSERT INTO platform.environment_settings (key, value, tenant_id, updated_by)
VALUES ('SetupComplete', 'true', '_system', 'postgres-init')
ON CONFLICT (tenant_id, key) DO NOTHING;