CREATE TABLE "sub_tasks" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"task_id" uuid NOT NULL,
	"job_started" timestamp (6) with time zone,
	"job_completed" timestamp (6) with time zone,
	"status" text DEFAULT 'In Progress' NOT NULL,
	"inputs" text,
	"outputs" text,
	"cloud_logs_url" text,
	"updated_at" timestamp (6) with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "tasks" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"task_source" text NOT NULL,
	"job_started" timestamp (6) with time zone,
	"job_completed" timestamp (6) with time zone,
	"status" text DEFAULT 'In Progress' NOT NULL,
	"service" text,
	"updated_at" timestamp (6) with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "sub_tasks" ADD CONSTRAINT "sub_tasks_task_id_tasks_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."tasks"("id") ON DELETE cascade ON UPDATE no action;