diff --git a/cameleer3-server-app/src/main/resources/db/migration/V10__audit_log.sql b/cameleer3-server-app/src/main/resources/db/migration/V10__audit_log.sql new file mode 100644 index 00000000..d10230a6 --- /dev/null +++ b/cameleer3-server-app/src/main/resources/db/migration/V10__audit_log.sql @@ -0,0 +1,18 @@ +CREATE TABLE audit_log ( + id BIGSERIAL PRIMARY KEY, + timestamp TIMESTAMPTZ NOT NULL DEFAULT now(), + username TEXT NOT NULL, + action TEXT NOT NULL, + category TEXT NOT NULL, + target TEXT, + detail JSONB, + result TEXT NOT NULL, + ip_address TEXT, + user_agent TEXT +); + +CREATE INDEX idx_audit_log_timestamp ON audit_log (timestamp DESC); +CREATE INDEX idx_audit_log_username ON audit_log (username); +CREATE INDEX idx_audit_log_category ON audit_log (category); +CREATE INDEX idx_audit_log_action ON audit_log (action); +CREATE INDEX idx_audit_log_target ON audit_log (target); diff --git a/cameleer3-server-app/src/main/resources/db/migration/V9__admin_thresholds.sql b/cameleer3-server-app/src/main/resources/db/migration/V9__admin_thresholds.sql new file mode 100644 index 00000000..9b618c97 --- /dev/null +++ b/cameleer3-server-app/src/main/resources/db/migration/V9__admin_thresholds.sql @@ -0,0 +1,7 @@ +CREATE TABLE admin_thresholds ( + id INTEGER PRIMARY KEY DEFAULT 1, + config JSONB NOT NULL DEFAULT '{}', + updated_at TIMESTAMPTZ NOT NULL DEFAULT now(), + updated_by TEXT NOT NULL, + CONSTRAINT single_row CHECK (id = 1) +);