Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

2.3 KB
Raw Blame
ALTER TABLE "git_provider_connection" ADD COLUMN "team_id" integer;
--> statement-breakpoint
ALTER TABLE "git_managed_repository" ADD COLUMN "project_id" integer;
--> statement-breakpoint

UPDATE "git_provider_connection" AS connection
SET "team_id" = project."team_id"
FROM "project" AS project
WHERE connection."project_id" = project."id";
--> statement-breakpoint

UPDATE "git_managed_repository" AS repository
SET "project_id" = connection."project_id"
FROM "git_provider_connection" AS connection
WHERE repository."connection_id" = connection."id";
--> statement-breakpoint

ALTER TABLE "git_managed_repository" DROP CONSTRAINT "git_managed_repository_connection_external_unique";
--> statement-breakpoint
ALTER TABLE "git_provider_connection" ALTER COLUMN "team_id" SET NOT NULL;
--> statement-breakpoint
ALTER TABLE "git_managed_repository" ALTER COLUMN "project_id" SET NOT NULL;
--> statement-breakpoint
ALTER TABLE "git_provider_connection" ADD CONSTRAINT "git_provider_connection_team_id_team_id_fk" FOREIGN KEY ("team_id") REFERENCES "public"."team"("id") ON DELETE cascade ON UPDATE no action;
--> statement-breakpoint
ALTER TABLE "git_managed_repository" ADD CONSTRAINT "git_managed_repository_project_id_project_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."project"("id") ON DELETE cascade ON UPDATE no action;
--> statement-breakpoint
ALTER TABLE "git_provider_connection" DROP CONSTRAINT "git_provider_connection_project_id_project_id_fk";
--> statement-breakpoint
ALTER TABLE "git_provider_connection" DROP CONSTRAINT "git_provider_connection_project_provider_url_account_unique";
--> statement-breakpoint
DROP INDEX "git_provider_connection_project_idx";
--> statement-breakpoint
DROP INDEX "git_managed_repository_connection_idx";
--> statement-breakpoint
ALTER TABLE "git_provider_connection" DROP COLUMN "project_id";
--> statement-breakpoint
ALTER TABLE "git_managed_repository" ADD CONSTRAINT "git_managed_repository_project_connection_external_unique" UNIQUE("project_id", "connection_id", "external_id");
--> statement-breakpoint
CREATE INDEX "git_provider_connection_team_idx" ON "git_provider_connection" USING btree ("team_id");
--> statement-breakpoint
CREATE INDEX "git_managed_repository_project_connection_idx" ON "git_managed_repository" USING btree ("project_id", "connection_id");