merge: wave 2 executor (01-02) into main
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a5b8fcf9d3
commit
aa1a78d7d9
1081 files changed
+445341
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { pgTable, uuid, text, timestamp, jsonb, index, uniqueIndex } from "drizzle-orm/pg-core";
|
||||
import { companies } from "./companies.js";
|
||||
import { agents } from "./agents.js";
|
||||
import { heartbeatRuns } from "./heartbeat_runs.js";
|
||||
|
||||
export const agentTaskSessions = pgTable(
|
||||
"agent_task_sessions",
|
||||
{
|
||||
id: uuid("id").primaryKey().defaultRandom(),
|
||||
companyId: uuid("company_id").notNull().references(() => companies.id),
|
||||
agentId: uuid("agent_id").notNull().references(() => agents.id),
|
||||
adapterType: text("adapter_type").notNull(),
|
||||
taskKey: text("task_key").notNull(),
|
||||
sessionParamsJson: jsonb("session_params_json").$type<Record<string, unknown>>(),
|
||||
sessionDisplayId: text("session_display_id"),
|
||||
lastRunId: uuid("last_run_id").references(() => heartbeatRuns.id),
|
||||
lastError: text("last_error"),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
},
|
||||
(table) => ({
|
||||
companyAgentTaskUniqueIdx: uniqueIndex("agent_task_sessions_company_agent_adapter_task_uniq").on(
|
||||
table.companyId,
|
||||
table.agentId,
|
||||
table.adapterType,
|
||||
table.taskKey,
|
||||
),
|
||||
companyAgentUpdatedIdx: index("agent_task_sessions_company_agent_updated_idx").on(
|
||||
table.companyId,
|
||||
table.agentId,
|
||||
table.updatedAt,
|
||||
),
|
||||
companyTaskUpdatedIdx: index("agent_task_sessions_company_task_updated_idx").on(
|
||||
table.companyId,
|
||||
table.taskKey,
|
||||
table.updatedAt,
|
||||
),
|
||||
}),
|
||||
);
|
||||
Reference in new issue
Block a user