summaryrefslogtreecommitdiff
path: root/db/migrations/0067_remarkable_doctor_doom.sql
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrations/0067_remarkable_doctor_doom.sql')
-rw-r--r--db/migrations/0067_remarkable_doctor_doom.sql23
1 files changed, 23 insertions, 0 deletions
diff --git a/db/migrations/0067_remarkable_doctor_doom.sql b/db/migrations/0067_remarkable_doctor_doom.sql
new file mode 100644
index 00000000..dcc947f7
--- /dev/null
+++ b/db/migrations/0067_remarkable_doctor_doom.sql
@@ -0,0 +1,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; \ No newline at end of file