From ff902243a658067fae858a615c0629aa2e0a4837 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Wed, 11 Jun 2025 12:18:38 +0000 Subject: (대표님) 20250611 21시 15분 OCR 등 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema/ocr.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'db/schema/ocr.ts') 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', { -- cgit v1.2.3