Add new DB schemas: companies, agent_api_keys, approvals, cost_events, heartbeat_runs, issue_comments. Add corresponding shared types and validators. Update existing schemas (agents, goals, issues, projects) with new fields for company association, budgets, and richer metadata. Generate initial Drizzle migration. Update seed data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
23 lines
946 B
TypeScript
23 lines
946 B
TypeScript
import { pgTable, uuid, text, timestamp, index } from "drizzle-orm/pg-core";
|
|
import { companies } from "./companies.js";
|
|
import { issues } from "./issues.js";
|
|
import { agents } from "./agents.js";
|
|
|
|
export const issueComments = pgTable(
|
|
"issue_comments",
|
|
{
|
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
companyId: uuid("company_id").notNull().references(() => companies.id),
|
|
issueId: uuid("issue_id").notNull().references(() => issues.id),
|
|
authorAgentId: uuid("author_agent_id").references(() => agents.id),
|
|
authorUserId: text("author_user_id"),
|
|
body: text("body").notNull(),
|
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
},
|
|
(table) => ({
|
|
issueIdx: index("issue_comments_issue_idx").on(table.issueId),
|
|
companyIdx: index("issue_comments_company_idx").on(table.companyId),
|
|
}),
|
|
);
|