kaneo (minimalist kanban) fork to experiment adding a tangled integration github.com/usekaneo/kaneo
at main 109 lines 4.9 kB view raw
1CREATE TABLE "activity" ( 2 "id" text PRIMARY KEY NOT NULL, 3 "task_id" text NOT NULL, 4 "type" text NOT NULL, 5 "created_at" timestamp DEFAULT now() NOT NULL, 6 "user_email" text NOT NULL, 7 "content" text 8); 9--> statement-breakpoint 10CREATE TABLE "label" ( 11 "id" text PRIMARY KEY NOT NULL, 12 "name" text NOT NULL, 13 "color" text NOT NULL, 14 "created_at" timestamp DEFAULT now() NOT NULL, 15 "task_id" text NOT NULL 16); 17--> statement-breakpoint 18CREATE TABLE "notification" ( 19 "id" text PRIMARY KEY NOT NULL, 20 "user_email" text NOT NULL, 21 "title" text NOT NULL, 22 "content" text, 23 "type" text DEFAULT 'info' NOT NULL, 24 "is_read" boolean DEFAULT false, 25 "resource_id" text, 26 "resource_type" text, 27 "created_at" timestamp DEFAULT now() NOT NULL 28); 29--> statement-breakpoint 30CREATE TABLE "project" ( 31 "id" text PRIMARY KEY NOT NULL, 32 "workspace_id" text NOT NULL, 33 "slug" text NOT NULL, 34 "icon" text DEFAULT 'Layout', 35 "name" text NOT NULL, 36 "description" text, 37 "created_at" timestamp DEFAULT now() NOT NULL, 38 "is_public" boolean DEFAULT false 39); 40--> statement-breakpoint 41CREATE TABLE "session" ( 42 "id" text PRIMARY KEY NOT NULL, 43 "user_id" text NOT NULL, 44 "expires_at" timestamp NOT NULL 45); 46--> statement-breakpoint 47CREATE TABLE "task" ( 48 "id" text PRIMARY KEY NOT NULL, 49 "project_id" text NOT NULL, 50 "position" integer DEFAULT 0, 51 "number" integer DEFAULT 1, 52 "assignee_email" text, 53 "title" text NOT NULL, 54 "description" text, 55 "status" text DEFAULT 'to-do' NOT NULL, 56 "priority" text DEFAULT 'low', 57 "due_date" timestamp, 58 "created_at" timestamp DEFAULT now() NOT NULL 59); 60--> statement-breakpoint 61CREATE TABLE "time_entry" ( 62 "id" text PRIMARY KEY NOT NULL, 63 "task_id" text NOT NULL, 64 "user_email" text, 65 "description" text, 66 "start_time" timestamp NOT NULL, 67 "end_time" timestamp, 68 "duration" integer DEFAULT 0, 69 "created_at" timestamp DEFAULT now() NOT NULL 70); 71--> statement-breakpoint 72CREATE TABLE "user" ( 73 "id" text PRIMARY KEY NOT NULL, 74 "name" text NOT NULL, 75 "password" text NOT NULL, 76 "email" text NOT NULL, 77 "created_at" timestamp DEFAULT now() NOT NULL, 78 CONSTRAINT "user_email_unique" UNIQUE("email") 79); 80--> statement-breakpoint 81CREATE TABLE "workspace" ( 82 "id" text PRIMARY KEY NOT NULL, 83 "name" text NOT NULL, 84 "description" text, 85 "owner_email" text NOT NULL, 86 "created_at" timestamp DEFAULT now() NOT NULL 87); 88--> statement-breakpoint 89CREATE TABLE "workspace_member" ( 90 "id" text PRIMARY KEY NOT NULL, 91 "workspace_id" text, 92 "user_email" text NOT NULL, 93 "role" text DEFAULT 'member' NOT NULL, 94 "joined_at" timestamp DEFAULT now() NOT NULL, 95 "status" text DEFAULT 'pending' NOT NULL 96); 97--> statement-breakpoint 98ALTER TABLE "activity" ADD CONSTRAINT "activity_task_id_task_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."task"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint 99ALTER TABLE "activity" ADD CONSTRAINT "activity_user_email_user_email_fk" FOREIGN KEY ("user_email") REFERENCES "public"."user"("email") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint 100ALTER TABLE "label" ADD CONSTRAINT "label_task_id_task_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."task"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint 101ALTER TABLE "notification" ADD CONSTRAINT "notification_user_email_user_email_fk" FOREIGN KEY ("user_email") REFERENCES "public"."user"("email") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint 102ALTER TABLE "project" ADD CONSTRAINT "project_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint 103ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint 104ALTER TABLE "task" ADD CONSTRAINT "task_project_id_project_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."project"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint 105ALTER TABLE "task" ADD CONSTRAINT "task_assignee_email_user_email_fk" FOREIGN KEY ("assignee_email") REFERENCES "public"."user"("email") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint 106ALTER TABLE "time_entry" ADD CONSTRAINT "time_entry_task_id_task_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."task"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint 107ALTER TABLE "time_entry" ADD CONSTRAINT "time_entry_user_email_user_email_fk" FOREIGN KEY ("user_email") REFERENCES "public"."user"("email") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint 108ALTER TABLE "workspace" ADD CONSTRAINT "workspace_owner_email_user_email_fk" FOREIGN KEY ("owner_email") REFERENCES "public"."user"("email") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint 109ALTER TABLE "workspace_member" ADD CONSTRAINT "workspace_member_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE cascade ON UPDATE cascade;