refactor(db): remove legacy PDF parse fields from documents schema

Eliminate parseState and parsedJsonKey columns from the documents table in both
Postgres and SQLite schemas, including related migration scripts and type
removal in document registration logic. This aligns the schema with the new
worker-based PDF parse model and reduces legacy field clutter.
This commit is contained in:
Richard R 2026-06-04 20:17:23 -06:00
parent 9db30742f8
commit 25342371a4
9 changed files with 3649 additions and 11 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE "documents" DROP COLUMN "parse_state";--> statement-breakpoint
ALTER TABLE "documents" DROP COLUMN "parsed_json_key";

File diff suppressed because it is too large Load diff

View file

@ -64,6 +64,13 @@
"when": 1780162695652,
"tag": "0008_user_job_events",
"breakpoints": true
},
{
"idx": 9,
"version": "7",
"when": 1780625663880,
"tag": "0009_drop_pdf_parse",
"breakpoints": true
}
]
}

View file

@ -0,0 +1,2 @@
ALTER TABLE `documents` DROP COLUMN `parse_state`;--> statement-breakpoint
ALTER TABLE `documents` DROP COLUMN `parsed_json_key`;

File diff suppressed because it is too large Load diff

View file

@ -64,6 +64,13 @@
"when": 1780162695101,
"tag": "0008_user_job_events",
"breakpoints": true
},
{
"idx": 9,
"version": "6",
"when": 1780625663601,
"tag": "0009_drop_pdf_parse",
"breakpoints": true
}
]
}

View file

@ -12,8 +12,6 @@ export const documents = pgTable('documents', {
size: bigint('size', { mode: 'number' }).notNull(),
lastModified: bigint('last_modified', { mode: 'number' }).notNull(),
filePath: text('file_path').notNull(),
parseState: text('parse_state'),
parsedJsonKey: text('parsed_json_key'),
createdAt: bigint('created_at', { mode: 'number' }).default(PG_NOW_MS),
}, (table) => [
primaryKey({ columns: [table.id, table.userId] }),

View file

@ -12,8 +12,6 @@ export const documents = sqliteTable('documents', {
size: integer('size').notNull(),
lastModified: integer('last_modified').notNull(),
filePath: text('file_path').notNull(),
parseState: text('parse_state'),
parsedJsonKey: text('parsed_json_key'),
createdAt: integer('created_at').default(SQLITE_NOW_MS),
}, (table) => [
primaryKey({ columns: [table.id, table.userId] }),

View file

@ -17,9 +17,6 @@ type RegisterUploadedDocumentInput = {
};
export async function registerUploadedDocument(input: RegisterUploadedDocumentInput): Promise<BaseDocument> {
const parseState = null;
const parsedJsonKey = null;
await db
.insert(documents)
.values({
@ -30,8 +27,6 @@ export async function registerUploadedDocument(input: RegisterUploadedDocumentIn
size: input.size,
lastModified: input.lastModified,
filePath: input.documentId,
parseState,
parsedJsonKey,
})
.onConflictDoUpdate({
target: [documents.id, documents.userId],
@ -41,8 +36,6 @@ export async function registerUploadedDocument(input: RegisterUploadedDocumentIn
size: input.size,
lastModified: input.lastModified,
filePath: input.documentId,
parseState,
parsedJsonKey,
},
});