Files

13 lines
434 B
SQL

CREATE TABLE "audit_log" (
"id" text PRIMARY KEY NOT NULL,
"actor_id" text NOT NULL,
"actor_ip_hash" text,
"action" text NOT NULL,
"entity_type" text NOT NULL,
"entity_id" text,
"before_json" text DEFAULT '' NOT NULL,
"after_json" text DEFAULT '' NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE INDEX "audit_log_created_idx" ON "audit_log" USING btree ("created_at");