Initial commit
This commit is contained in:
20
prisma/migrations/202604081930_audit_logs/migration.sql
Normal file
20
prisma/migrations/202604081930_audit_logs/migration.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
CREATE TABLE "audit_logs" (
|
||||
"id" TEXT NOT NULL,
|
||||
"actor_id" TEXT,
|
||||
"action" TEXT NOT NULL,
|
||||
"entity_type" TEXT NOT NULL,
|
||||
"entity_id" TEXT,
|
||||
"entity_label" TEXT,
|
||||
"summary" TEXT NOT NULL,
|
||||
"metadata" JSONB,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "audit_logs_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE INDEX "audit_logs_created_at_idx" ON "audit_logs"("created_at");
|
||||
|
||||
ALTER TABLE "audit_logs"
|
||||
ADD CONSTRAINT "audit_logs_actor_id_fkey"
|
||||
FOREIGN KEY ("actor_id") REFERENCES "users"("id")
|
||||
ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
Reference in New Issue
Block a user