CREATE TABLE "projects" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "name" text NOT NULL, "description" text, "status" text DEFAULT 'active' NOT NULL, "created_at" timestamp DEFAULT now() NOT NULL, "updated_at" timestamp DEFAULT now() NOT NULL, CONSTRAINT "project_status_check" CHECK ("projects"."status" IN ('active', 'archived', 'completed')) ); --> statement-breakpoint CREATE TABLE "tasks" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "project_id" uuid NOT NULL, "title" text NOT NULL, "description" text, "status" text DEFAULT 'todo' NOT NULL, "priority" text DEFAULT 'medium' NOT NULL, "sort_order" integer DEFAULT 0 NOT NULL, "due_date" timestamp, "created_at" timestamp DEFAULT now() NOT NULL, "updated_at" timestamp DEFAULT now() NOT NULL, CONSTRAINT "task_status_check" CHECK ("tasks"."status" IN ('todo', 'in_progress', 'in_review', 'done')), CONSTRAINT "task_priority_check" CHECK ("tasks"."priority" IN ('low', 'medium', 'high', 'urgent')) ); --> statement-breakpoint ALTER TABLE "tasks" ADD CONSTRAINT "tasks_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;