From fb276ed3db86fe4fc0c0fcd870fd3d085b034be0 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Thu, 17 Jul 2025 10:50:28 +0000 Subject: (대표님) 벤더데이터 S-EDP 변경사항 대응(seperator), 정기평가 점수오류, dim 준비 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema/vendorData.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'db/schema/vendorData.ts') diff --git a/db/schema/vendorData.ts b/db/schema/vendorData.ts index b7c70e72..5e1e65cf 100644 --- a/db/schema/vendorData.ts +++ b/db/schema/vendorData.ts @@ -82,7 +82,9 @@ export const tags = pgTable("tags", { .references(() => forms.id, { onDelete: "set null" }), tagNo: varchar("tag_no", { length: 100 }).notNull(), tagType: varchar("tag_type", { length: 50 }).notNull(), - class: varchar("class", { length: 100 }).notNull(), + class: varchar("class", { length: 100 }).notNull(), // 기존 필드 유지 (호환성) + tagClassId: integer("tag_class_id") + .references(() => tagClasses.id, { onDelete: "set null" }), // 새로운 관계 필드 description: text("description"), createdAt: timestamp("created_at").defaultNow().notNull(), updatedAt: timestamp("updated_at").defaultNow().notNull(), @@ -92,6 +94,7 @@ export const tags = pgTable("tags", { }; }); + // tagTypes에 projectId 추가 및 복합 기본키 생성 export const tagTypes = pgTable("tag_types", { code: varchar("code", { length: 50 }).notNull(), @@ -182,6 +185,10 @@ export const tagClasses = pgTable("tag_classes", { code: varchar("code", { length: 100 }).notNull(), label: text("label").notNull(), tagTypeCode: varchar("tag_type_code", { length: 50 }).notNull(), + // 서브클래스 정보 (ID와 DESC를 포함한 객체 배열) + subclasses: json("subclasses").$type<{id: string, desc: string}[]>().default([]), + // 서브클래스별 리마크 (JSON 객체) + subclassRemark: json("subclass_remark").$type>().default({}), createdAt: timestamp("created_at").defaultNow().notNull(), updatedAt: timestamp("updated_at").defaultNow().notNull(), }, (table) => { @@ -197,7 +204,7 @@ export const tagClasses = pgTable("tag_classes", { foreignColumns: [tagTypes.code, tagTypes.projectId] }).onDelete("cascade") }; -}) +}); export const tagClassAttributes = pgTable("tag_class_attributes", { id: integer("id").primaryKey().generatedAlwaysAsIdentity(), @@ -221,6 +228,8 @@ export const tagClassAttributes = pgTable("tag_class_attributes", { seqIdx: index("tag_class_attributes_seq_idx").on(table.seq) }; }); + + // tagTypeClassFormMappings에 projectId 추가 export const tagTypeClassFormMappings = pgTable("tag_type_class_form_mappings", { id: serial("id").primaryKey(), -- cgit v1.2.3