diff --git a/src/databases/officer_db/src/index.ts b/src/databases/officer_db/src/index.ts index 5296e614..261420db 100644 --- a/src/databases/officer_db/src/index.ts +++ b/src/databases/officer_db/src/index.ts @@ -40,8 +40,6 @@ export * from './user-data'; export * from './vault'; export * from './wallet'; -// `operations` is deliberately absent: it has a schema and no queries. Its `task_logs` is reached as -// `schema.taskLogs` from src/servers/api/task-logger.ts, which reaches past this package's own boundary. -// Its other two tables, `queue_jobs` and `terminal_containers`, are read by nothing at all — the queue -// engine works on files (src/servers/queue/storage.ts) and terminal containers are from an architecture -// that is gone. Give it a queries.ts and it earns a line here. +// `operations` is deliberately absent: it has a schema and no queries. Its one table, `task_logs`, is +// reached as `schema.taskLogs` from src/servers/api/task-logger.ts, which reaches past this package's +// own boundary. Give it a queries.ts and it earns a line here. diff --git a/src/databases/officer_db/src/operations/schema.ts b/src/databases/officer_db/src/operations/schema.ts index d164d882..d60abe5f 100644 --- a/src/databases/officer_db/src/operations/schema.ts +++ b/src/databases/officer_db/src/operations/schema.ts @@ -1,3 +1,19 @@ +// Task run logs. +// +// This file held two other tables until 2026-08-13, both dead and both removed: +// +// queue_jobs the background job engine's state, from when it kept it in Postgres. It works +// on files now (src/servers/queue/storage.ts) and had not read this table since. +// terminal_containers a docker id and port per user, from the architecture where every account ran +// inside its own container. That is gone — see data-path.ts on getHomeDir. +// +// Neither had a single reader or writer anywhere in the tree. They were created on every fresh install +// by db:push and then never touched. +// +// What is left is one table with no queries.ts beside it: task_logs is reached as `schema.taskLogs` +// from src/servers/api/task-logger.ts, which reaches past this package's boundary. That is the next +// thing to fix here. + import { pgTable, serial, text, integer, boolean, timestamp, jsonb, index } from 'drizzle-orm/pg-core'; import { users } from '../auth/schema'; @@ -17,28 +33,3 @@ export const taskLogs = pgTable('task_logs', { }, (table) => [ index('idx_task_logs_user_started').on(table.userId, table.startedAt), ]); - -export const queueJobs = pgTable('queue_jobs', { - id: text('id').primaryKey(), - userId: integer('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), - lane: text('lane').notNull(), - type: text('type').notNull(), - status: text('status', { enum: ['queued', 'running', 'completed', 'failed', 'cancelled'] }).notNull().default('queued'), - currentStep: integer('current_step').notNull().default(0), - steps: jsonb('steps').notNull().default([]), - meta: jsonb('meta'), - error: text('error'), - createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(), - startedAt: timestamp('started_at', { withTimezone: true }), - completedAt: timestamp('completed_at', { withTimezone: true }), -}, (table) => [ - index('idx_queue_jobs_status_lane').on(table.status, table.lane), - index('idx_queue_jobs_user').on(table.userId), -]); - -export const terminalContainers = pgTable('terminal_containers', { - userId: integer('user_id').primaryKey().references(() => users.id, { onDelete: 'cascade' }), - dockerId: text('docker_id').notNull(), - port: integer('port').notNull(), - updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(), -}); diff --git a/src/databases/officer_db/src/schema.ts b/src/databases/officer_db/src/schema.ts index 9c758e69..b4eb4108 100644 --- a/src/databases/officer_db/src/schema.ts +++ b/src/databases/officer_db/src/schema.ts @@ -27,7 +27,7 @@ export * from './api-keys/schema'; // api_keys export * from './user-data/schema'; // user_settings, user_state, user_integrations, dock_configs export * from './dashboards/schema'; // dashboards, screens, dashboard_defaults export * from './server/schema'; // server_config (SMTP lives here), server_integrations -export * from './operations/schema'; // task_logs, queue_jobs, terminal_containers +export * from './operations/schema'; // task_logs export * from './pipeline-jobs/schema'; // pipeline_jobs export * from './chat-events/schema'; // chat_session_events export * from './agent-panels/schema'; // agent_panels diff --git a/src/databases/officer_db/src/types.ts b/src/databases/officer_db/src/types.ts index 7b52c469..454f0ca6 100644 --- a/src/databases/officer_db/src/types.ts +++ b/src/databases/officer_db/src/types.ts @@ -49,12 +49,6 @@ export type ScreenInsert = typeof Schema.screens.$inferInsert; export type TaskLogSelect = typeof Schema.taskLogs.$inferSelect; export type TaskLogInsert = typeof Schema.taskLogs.$inferInsert; -export type QueueJobSelect = typeof Schema.queueJobs.$inferSelect; -export type QueueJobInsert = typeof Schema.queueJobs.$inferInsert; - -export type TerminalContainerSelect = typeof Schema.terminalContainers.$inferSelect; -export type TerminalContainerInsert = typeof Schema.terminalContainers.$inferInsert; - // ── Email ── export type EmailAccountSelect = typeof Schema.emailAccounts.$inferSelect;