summaryrefslogtreecommitdiff
path: root/db/migrations/0067_remarkable_doctor_doom.sql
blob: dcc947f7f75267f7c83f78788f767596cb9af74d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
CREATE TABLE "preset_shares" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"preset_id" uuid NOT NULL,
	"shared_with_user_id" text NOT NULL,
	"permission" text DEFAULT 'read' NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "table_presets" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"user_id" text NOT NULL,
	"table_id" text NOT NULL,
	"name" text NOT NULL,
	"settings" json NOT NULL,
	"is_default" boolean DEFAULT false NOT NULL,
	"is_active" boolean DEFAULT false NOT NULL,
	"is_shared" boolean DEFAULT false NOT NULL,
	"created_by" text,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "preset_shares" ADD CONSTRAINT "preset_shares_preset_id_table_presets_id_fk" FOREIGN KEY ("preset_id") REFERENCES "public"."table_presets"("id") ON DELETE cascade ON UPDATE no action;