Files
geo/server/migrations/20260331100031_create_audit_logs.up.sql
T

13 lines
426 B
SQL
Raw Normal View History

CREATE TABLE audit_logs (
id BIGSERIAL PRIMARY KEY,
operator_id BIGINT NOT NULL REFERENCES users(id),
tenant_id BIGINT,
module VARCHAR(50) NOT NULL,
action VARCHAR(50) NOT NULL,
before_json JSONB,
after_json JSONB,
result VARCHAR(20),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_audit_module_created ON audit_logs(module, created_at DESC);