From b12a06766e32e3c76544b1d12bec91653e1fe9db Mon Sep 17 00:00:00 2001 From: 0-Zz-ang Date: Mon, 25 Aug 2025 09:23:30 +0900 Subject: docu-list-rule페이지 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema/docu-list-rule.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'db/schema/docu-list-rule.ts') diff --git a/db/schema/docu-list-rule.ts b/db/schema/docu-list-rule.ts index 27cace80..612c8045 100644 --- a/db/schema/docu-list-rule.ts +++ b/db/schema/docu-list-rule.ts @@ -56,6 +56,7 @@ export const documentClassOptions = pgTable("document_class_options_new", { documentClassId: integer("document_class_id").notNull().references(() => documentClasses.id), description: varchar("description", { length: 100 }).notNull(), // 하위 옵션 설명 (예: "General", "Technical") optionCode: varchar("option_code", { length: 50 }), // 하위 옵션 코드 (선택사항) + sdq: integer("sdq").notNull(), // 순서 번호 (1, 2, 3, 4, 5, 6) isActive: boolean("is_active").default(true), createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(), updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(), @@ -66,6 +67,11 @@ export const documentClassOptions = pgTable("document_class_options_new", { table.documentClassId, table.optionCode ), + // 같은 documentClassId 내에서 sdq는 유니크해야 함 + uniqueDocumentClassSdq: unique("unique_document_class_sdq").on( + table.documentClassId, + table.sdq + ), } }) @@ -76,6 +82,7 @@ export const comboBoxSettings = pgTable("combo_box_settings", { code: varchar("code", { length: 50 }).notNull(), // CODE (예: 100, 201, 202) description: varchar("description", { length: 200 }).notNull(), // Description (예: General, Feed Gas Reveive) remark: text("remark"), // Remark (비고) + sdq: integer("sdq").notNull(), // 순서 번호 (1, 2, 3, 4, 5, 6) createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(), updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(), }, (table) => { @@ -85,6 +92,11 @@ export const comboBoxSettings = pgTable("combo_box_settings", { table.codeGroupId, table.code ), + // 같은 codeGroupId 내에서 sdq는 유니크해야 함 + uniqueCodeGroupSdq: unique("unique_code_group_sdq").on( + table.codeGroupId, + table.sdq + ), } }) -- cgit v1.2.3