summaryrefslogtreecommitdiff
path: root/db/schema/vendorData.ts
diff options
context:
space:
mode:
Diffstat (limited to 'db/schema/vendorData.ts')
-rw-r--r--db/schema/vendorData.ts13
1 files changed, 11 insertions, 2 deletions
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<Record<string, string>>().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(),