drop two dead tables: queue_jobs and terminal_containers
Neither had a reader or a writer anywhere in the tree. db:push created them on every fresh install and nothing ever touched them. queue_jobs is from when the background job engine kept its state in Postgres; it works on files now (src/servers/queue/storage.ts). terminal_containers held a docker id and port per user, from the architecture where every account ran in its own container — gone, as data-path.ts already records. Their types went with them: QueueJobSelect/Insert and TerminalContainerSelect/ Insert were unreferenced too. db:push now creates 22 tables. operations/schema.ts keeps task_logs and a note about what left and why, along with the thing still wrong there: it has no queries.ts, because task_logs is reached as `schema.taskLogs` from src/servers/api/task-logger.ts, past this package's boundary. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -40,8 +40,6 @@ export * from './user-data';
|
|||||||
export * from './vault';
|
export * from './vault';
|
||||||
export * from './wallet';
|
export * from './wallet';
|
||||||
|
|
||||||
// `operations` is deliberately absent: it has a schema and no queries. Its `task_logs` is reached as
|
// `operations` is deliberately absent: it has a schema and no queries. Its one table, `task_logs`, is
|
||||||
// `schema.taskLogs` from src/servers/api/task-logger.ts, which reaches past this package's own boundary.
|
// reached as `schema.taskLogs` from src/servers/api/task-logger.ts, which reaches past this package's
|
||||||
// Its other two tables, `queue_jobs` and `terminal_containers`, are read by nothing at all — the queue
|
// own boundary. Give it a queries.ts and it earns a line here.
|
||||||
// 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.
|
|
||||||
|
|||||||
@@ -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 { pgTable, serial, text, integer, boolean, timestamp, jsonb, index } from 'drizzle-orm/pg-core';
|
||||||
import { users } from '../auth/schema';
|
import { users } from '../auth/schema';
|
||||||
|
|
||||||
@@ -17,28 +33,3 @@ export const taskLogs = pgTable('task_logs', {
|
|||||||
}, (table) => [
|
}, (table) => [
|
||||||
index('idx_task_logs_user_started').on(table.userId, table.startedAt),
|
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(),
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -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 './user-data/schema'; // user_settings, user_state, user_integrations, dock_configs
|
||||||
export * from './dashboards/schema'; // dashboards, screens, dashboard_defaults
|
export * from './dashboards/schema'; // dashboards, screens, dashboard_defaults
|
||||||
export * from './server/schema'; // server_config (SMTP lives here), server_integrations
|
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 './pipeline-jobs/schema'; // pipeline_jobs
|
||||||
export * from './chat-events/schema'; // chat_session_events
|
export * from './chat-events/schema'; // chat_session_events
|
||||||
export * from './agent-panels/schema'; // agent_panels
|
export * from './agent-panels/schema'; // agent_panels
|
||||||
|
|||||||
@@ -49,12 +49,6 @@ export type ScreenInsert = typeof Schema.screens.$inferInsert;
|
|||||||
export type TaskLogSelect = typeof Schema.taskLogs.$inferSelect;
|
export type TaskLogSelect = typeof Schema.taskLogs.$inferSelect;
|
||||||
export type TaskLogInsert = typeof Schema.taskLogs.$inferInsert;
|
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 ──
|
// ── Email ──
|
||||||
|
|
||||||
export type EmailAccountSelect = typeof Schema.emailAccounts.$inferSelect;
|
export type EmailAccountSelect = typeof Schema.emailAccounts.$inferSelect;
|
||||||
|
|||||||
Reference in New Issue
Block a user