diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-08-11 09:02:00 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-08-11 09:02:00 +0000 |
| commit | cbb4c7fe0b94459162ad5e998bc05cd293e0ff96 (patch) | |
| tree | 0a26712f7685e4f6511e637b9a81269d90a47c8f /db/schema/vendorData.ts | |
| parent | eb654f88214095f71be142b989e620fd28db3f69 (diff) | |
(대표님) 입찰, EDP 변경사항 대응, spreadJS 오류 수정, 벤더실사 수정
Diffstat (limited to 'db/schema/vendorData.ts')
| -rw-r--r-- | db/schema/vendorData.ts | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/db/schema/vendorData.ts b/db/schema/vendorData.ts index a512a8d7..20348c55 100644 --- a/db/schema/vendorData.ts +++ b/db/schema/vendorData.ts @@ -80,7 +80,13 @@ export const tags = pgTable("tags", { .references(() => contractItems.id, { onDelete: "cascade" }), formId: integer("form_id") .references(() => forms.id, { onDelete: "set null" }), + + // SEDP에서 오는 고유 식별자 - 이것으로 태그를 식별 + tagIdx: varchar("tag_idx", { length: 100 }).notNull(), + + // 사용자가 편집 가능한 태그 번호 - 편집 중 일시적 중복 허용 tagNo: varchar("tag_no", { length: 100 }).notNull(), + tagType: varchar("tag_type", { length: 50 }).notNull(), class: varchar("class", { length: 100 }).notNull(), // 기존 필드 유지 (호환성) tagClassId: integer("tag_class_id") @@ -90,11 +96,18 @@ export const tags = pgTable("tags", { updatedAt: timestamp("updated_at").defaultNow().notNull(), }, (table) => { return { - contractItemTagNoUnique: unique("contract_item_tag_no_unique").on(table.contractItemId, table.tagNo), + // tagIdx를 기준으로 한 unique 제약조건 (SEDP 데이터 기준) + contractItemTagIdxUnique: unique("contract_item_tag_idx_unique").on(table.contractItemId, table.tagIdx), + + // tagNo는 unique 제약조건을 제거하거나 완화 + // 최종적으로 tagNo가 유니크해야 한다면, 별도의 validation이나 + // 편집 완료 시점에 체크하는 로직으로 처리 + + // 만약 일반적인 상황에서는 tagNo도 유니크해야 한다면 이 옵션도 고려: + // contractItemTagNoIndex: index("contract_item_tag_no_idx").on(table.contractItemId, table.tagNo), }; }); - // tagTypes에 projectId 추가 및 복합 기본키 생성 export const tagTypes = pgTable("tag_types", { code: varchar("code", { length: 50 }).notNull(), @@ -233,13 +246,13 @@ export const tagClassAttributes = pgTable("tag_class_attributes", { // tagTypeClassFormMappings에 projectId 추가 export const tagTypeClassFormMappings = pgTable("tag_type_class_form_mappings", { id: serial("id").primaryKey(), - projectId: integer("project_id").notNull(), // Remove the reference here + projectId: integer("project_id").notNull(), tagTypeLabel: varchar("tag_type_label", { length: 255 }).notNull(), classLabel: varchar("class_label", { length: 255 }).notNull(), formCode: varchar("form_code", { length: 50 }).notNull(), formName: varchar("form_name", { length: 255 }).notNull(), ep: varchar("ep", { length: 255 }), - remark: varchar("remark", { length: 255 }), + remark: text("remark"), // varchar에서 text로 변경 createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(), updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(), }, (table) => { @@ -364,7 +377,7 @@ export type FormListsView = typeof formListsView.$inferSelect; // TemplateItem 스키마 정의 -export const templateItems = pgTable("template_items", { +export const templateItems = pgTable("template_items", { id: serial("id").primaryKey(), // tag_type_class_form_mappings 테이블과의 관계 |
