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:
parent
9db30742f8
commit
25342371a4
9 changed files with 3649 additions and 11 deletions
2
drizzle/postgres/0009_drop_pdf_parse.sql
Normal file
2
drizzle/postgres/0009_drop_pdf_parse.sql
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE "documents" DROP COLUMN "parse_state";--> statement-breakpoint
|
||||
ALTER TABLE "documents" DROP COLUMN "parsed_json_key";
|
||||
1894
drizzle/postgres/meta/0009_snapshot.json
Normal file
1894
drizzle/postgres/meta/0009_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
2
drizzle/sqlite/0009_drop_pdf_parse.sql
Normal file
2
drizzle/sqlite/0009_drop_pdf_parse.sql
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `documents` DROP COLUMN `parse_state`;--> statement-breakpoint
|
||||
ALTER TABLE `documents` DROP COLUMN `parsed_json_key`;
|
||||
1737
drizzle/sqlite/meta/0009_snapshot.json
Normal file
1737
drizzle/sqlite/meta/0009_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -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] }),
|
||||
|
|
|
|||
|
|
@ -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] }),
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue