Files
cloud-ip-validator/internal/db/migrations/0002_dynamic_config.sql
T

27 lines
913 B
SQL

-- Dynamic configuration tables: sites, target_groups, check_types.
-- validators already exists (0001_init.sql) and needs no new columns.
-- Bootstrap semantics (apply YAML only when the table is empty) live in
-- internal/db/bootstrap.go, not in this migration.
CREATE TABLE sites (
idx INTEGER PRIMARY KEY, -- 1, 2 or 3 -- fixed slot
site_id TEXT NOT NULL UNIQUE,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL
);
CREATE TABLE target_groups (
group_name TEXT PRIMARY KEY,
targets TEXT NOT NULL, -- JSON array of strings
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL
);
CREATE TABLE check_types (
name TEXT PRIMARY KEY,
enabled BOOLEAN NOT NULL DEFAULT 1,
target_groups TEXT NOT NULL, -- JSON array of group names
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL
);