diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-11 12:18:38 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-11 12:18:38 +0000 |
| commit | ff902243a658067fae858a615c0629aa2e0a4837 (patch) | |
| tree | 42d30e986d1cbfb282c644c01730cd053b816b7a /db/schema/ocr.ts | |
| parent | 42e38f41cb4c0b4bf9c08b71ed087cd7f0c7fc18 (diff) | |
(대표님) 20250611 21시 15분 OCR 등
Diffstat (limited to 'db/schema/ocr.ts')
| -rw-r--r-- | db/schema/ocr.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/db/schema/ocr.ts b/db/schema/ocr.ts index 289eb297..12382aa4 100644 --- a/db/schema/ocr.ts +++ b/db/schema/ocr.ts @@ -9,9 +9,10 @@ import { boolean, jsonb, text, - serial + serial , uniqueIndex } from 'drizzle-orm/pg-core'; import { relations } from 'drizzle-orm'; +import { users } from './users'; // OCR 세션 테이블 (전체 처리 정보) export const ocrSessions = pgTable('ocr_sessions', { @@ -57,8 +58,13 @@ export const ocrRows = pgTable('ocr_rows', { confidence: decimal('confidence', { precision: 5, scale: 4 }), // 0.0000 ~ 1.0000 sourceTable: integer('source_table'), sourceRow: integer('source_row'), + userId: integer("user_id") + .references(() => users.id, { onDelete: "set null" }), createdAt: timestamp('created_at').notNull().defaultNow(), -}); +}, (t) => ({ + // tableId + reportNo + no 조합이 유일 + uniqReportAndNo: uniqueIndex('idx_ocr_report_no_unique').on(t.reportNo, t.no, t.tagNo, t.jointNo, t.jointType), +})); // 회전 시도 결과 export const ocrRotationAttempts = pgTable('ocr_rotation_attempts', { |
