Files
taskarr-mgr/drizzle/0001_kind_jamie_braddock.sql
Milas Holsting 8e02f673ca
Some checks failed
Build and Push Container Image / build-and-push (push) Failing after 3m49s
work
2026-05-26 17:44:22 +02:00

33 lines
1.8 KiB
SQL

CREATE TABLE "issue" (
"id" serial PRIMARY KEY NOT NULL,
"project_id" integer NOT NULL,
"provider" text NOT NULL,
"external_id" text NOT NULL,
"url" text NOT NULL,
"title" text NOT NULL,
"state" text NOT NULL,
"labels" text DEFAULT '[]' NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "project" (
"id" serial PRIMARY KEY NOT NULL,
"owner_id" text NOT NULL,
"name" text NOT NULL,
"description" text DEFAULT '' NOT NULL,
"status" text DEFAULT 'planning' NOT NULL,
"progress" integer DEFAULT 0 NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "task" ADD COLUMN "project_id" integer NOT NULL;--> statement-breakpoint
ALTER TABLE "task" ADD COLUMN "description" text DEFAULT '' NOT NULL;--> statement-breakpoint
ALTER TABLE "task" ADD COLUMN "status" text DEFAULT 'todo' NOT NULL;--> statement-breakpoint
ALTER TABLE "task" ADD COLUMN "due_date" timestamp;--> statement-breakpoint
ALTER TABLE "task" ADD COLUMN "created_at" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint
ALTER TABLE "task" ADD COLUMN "updated_at" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint
ALTER TABLE "issue" ADD CONSTRAINT "issue_project_id_project_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."project"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "project" ADD CONSTRAINT "project_owner_id_user_id_fk" FOREIGN KEY ("owner_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "task" ADD CONSTRAINT "task_project_id_project_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."project"("id") ON DELETE cascade ON UPDATE no action;