mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
sub tasks and task table added
This commit is contained in:
parent
7a80762b95
commit
6bb04a9a72
7 changed files with 9065 additions and 0 deletions
23
src/app/db/migrations/0124_mute_alice.sql
Normal file
23
src/app/db/migrations/0124_mute_alice.sql
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
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;
|
||||
4
src/app/db/migrations/0125_steady_thunderbolts.sql
Normal file
4
src/app/db/migrations/0125_steady_thunderbolts.sql
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
ALTER TABLE "sub_tasks" RENAME TO "sub_task";--> statement-breakpoint
|
||||
ALTER TABLE "sub_task" DROP CONSTRAINT "sub_tasks_task_id_tasks_id_fk";
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "sub_task" ADD CONSTRAINT "sub_task_task_id_tasks_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."tasks"("id") ON DELETE cascade ON UPDATE no action;
|
||||
4490
src/app/db/migrations/meta/0124_snapshot.json
Normal file
4490
src/app/db/migrations/meta/0124_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
4490
src/app/db/migrations/meta/0125_snapshot.json
Normal file
4490
src/app/db/migrations/meta/0125_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -869,6 +869,20 @@
|
|||
"when": 1761660543815,
|
||||
"tag": "0123_cloudy_gambit",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 124,
|
||||
"version": "7",
|
||||
"when": 1762793610067,
|
||||
"tag": "0124_mute_alice",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 125,
|
||||
"version": "7",
|
||||
"when": 1762793952263,
|
||||
"tag": "0125_steady_thunderbolts",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
25
src/app/db/schema/tasks/subtask.ts
Normal file
25
src/app/db/schema/tasks/subtask.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { pgTable, uuid, text, timestamp } from "drizzle-orm/pg-core";
|
||||
import { tasks } from "./tasks";
|
||||
|
||||
export const subTasks = pgTable("sub_task", {
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
|
||||
// foreign key to parent task
|
||||
taskId: uuid("task_id")
|
||||
.notNull()
|
||||
.references(() => tasks.id, { onDelete: "cascade" }),
|
||||
|
||||
jobStarted: timestamp("job_started", { precision: 6, withTimezone: true }),
|
||||
jobCompleted: timestamp("job_completed", { precision: 6, withTimezone: true }),
|
||||
|
||||
status: text("status").notNull().default("In Progress"),
|
||||
|
||||
inputs: text("inputs"), // could later change to JSONB if desired
|
||||
outputs: text("outputs"),
|
||||
cloudLogsURL: text("cloud_logs_url"),
|
||||
|
||||
updatedAt: timestamp("updated_at", { precision: 6, withTimezone: true })
|
||||
.defaultNow()
|
||||
.$onUpdate(() => new Date())
|
||||
.notNull(),
|
||||
});
|
||||
19
src/app/db/schema/tasks/tasks.ts
Normal file
19
src/app/db/schema/tasks/tasks.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { pgTable, uuid, text, timestamp } from "drizzle-orm/pg-core";
|
||||
|
||||
export const tasks = pgTable("tasks", {
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
|
||||
taskSource: text("task_source").notNull(),
|
||||
|
||||
jobStarted: timestamp("job_started", { precision: 6, withTimezone: true }),
|
||||
jobCompleted: timestamp("job_completed", { precision: 6, withTimezone: true }),
|
||||
|
||||
status: text("status").notNull().default("In Progress"), // default status
|
||||
|
||||
service: text("service"), // e.g. plan, wchg etc
|
||||
|
||||
updatedAt: timestamp("updated_at", { precision: 6, withTimezone: true })
|
||||
.defaultNow()
|
||||
.$onUpdate(() => new Date())
|
||||
.notNull(),
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue