mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat(db): add audit integrity/requestId columns, user_preferences table, audit indexes
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
CREATE TABLE "user_preferences" (
|
||||
"user_id" text NOT NULL,
|
||||
"key" text NOT NULL,
|
||||
"value" jsonb NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "user_preferences_user_id_key_pk" PRIMARY KEY("user_id","key")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "audit_log" ADD COLUMN "integrity" text;--> statement-breakpoint
|
||||
ALTER TABLE "audit_log" ADD COLUMN "request_id" text;--> statement-breakpoint
|
||||
ALTER TABLE "user_preferences" ADD CONSTRAINT "user_preferences_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "audit_log_created_at_idx" ON "audit_log" USING btree ("created_at");--> statement-breakpoint
|
||||
CREATE INDEX "audit_log_action_idx" ON "audit_log" USING btree ("action");--> statement-breakpoint
|
||||
CREATE INDEX "audit_log_actor_id_idx" ON "audit_log" USING btree ("actor_id");
|
||||
Reference in New Issue
Block a user