Files
taskarr-mgr/drizzle/0002_eager_shen.sql
Milas Holsting 56c9cca016
Some checks failed
Build and Push Container Image / build-and-push (push) Failing after 3m31s
work
2026-05-26 17:14:35 +02:00

28 lines
1.8 KiB
SQL

CREATE TABLE "github_installation" (
"id" serial PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"installation_id" text NOT NULL,
"account_login" text NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "github_installation_installation_id_unique" UNIQUE("installation_id")
);
--> statement-breakpoint
CREATE TABLE "github_repository_link" (
"id" serial PRIMARY KEY NOT NULL,
"project_id" integer NOT NULL,
"installation_id" integer NOT NULL,
"owner" text NOT NULL,
"repo" text NOT NULL,
"full_name" text NOT NULL,
"default_branch" text DEFAULT 'main' NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "github_repository_link_full_name_unique" UNIQUE("full_name")
);
--> statement-breakpoint
ALTER TABLE "github_installation" ADD CONSTRAINT "github_installation_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "github_repository_link" ADD CONSTRAINT "github_repository_link_project_id_project_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."project"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "github_repository_link" ADD CONSTRAINT "github_repository_link_installation_id_github_installation_id_fk" FOREIGN KEY ("installation_id") REFERENCES "public"."github_installation"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "github_installation_installation_id_idx" ON "github_installation" USING btree ("installation_id");--> statement-breakpoint
CREATE UNIQUE INDEX "github_repository_link_project_id_idx" ON "github_repository_link" USING btree ("project_id");