@hogsend/db 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
CREATE TABLE "links" (
|
|
2
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
3
|
+
"original_url" text NOT NULL,
|
|
4
|
+
"type" text DEFAULT 'public' NOT NULL,
|
|
5
|
+
"label" text,
|
|
6
|
+
"campaign" text,
|
|
7
|
+
"source" text NOT NULL,
|
|
8
|
+
"distinct_id" text,
|
|
9
|
+
"created_by" text,
|
|
10
|
+
"archived_at" timestamp with time zone,
|
|
11
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
12
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
ALTER TABLE "tracked_links" ADD COLUMN "link_id" uuid;--> statement-breakpoint
|
|
16
|
+
CREATE INDEX "links_source_idx" ON "links" USING btree ("source");--> statement-breakpoint
|
|
17
|
+
CREATE INDEX "links_campaign_idx" ON "links" USING btree ("campaign");--> statement-breakpoint
|
|
18
|
+
CREATE INDEX "links_created_at_idx" ON "links" USING btree ("created_at");--> statement-breakpoint
|
|
19
|
+
ALTER TABLE "tracked_links" ADD CONSTRAINT "tracked_links_link_id_links_id_fk" FOREIGN KEY ("link_id") REFERENCES "public"."links"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
20
|
+
CREATE INDEX "tracked_links_link_id_idx" ON "tracked_links" USING btree ("link_id");
|