diff options
| author | 0-Zz-ang <s1998319@gmail.com> | 2025-08-08 17:15:22 +0900 |
|---|---|---|
| committer | 0-Zz-ang <s1998319@gmail.com> | 2025-08-08 17:15:22 +0900 |
| commit | 7cdedf2cf8e807eeea9134888dc9bd1586978ea8 (patch) | |
| tree | e6b2eefda385ecbb6ae17494b9e05ccd8985e24d /db/schema | |
| parent | a6335760fc8e56d192f002eb0c3f26d1210d07a2 (diff) | |
(박서영)combo box 옵션 및 number type config Add에러 수정
Diffstat (limited to 'db/schema')
| -rw-r--r-- | db/schema/docu-list-rule.ts | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/db/schema/docu-list-rule.ts b/db/schema/docu-list-rule.ts index ec20ab7a..505b1c0d 100644 --- a/db/schema/docu-list-rule.ts +++ b/db/schema/docu-list-rule.ts @@ -72,7 +72,6 @@ export const documentClassOptions = pgTable("document_class_options_new", { // ===== ComboBox Settings 테이블 ===== export const comboBoxSettings = pgTable("combo_box_settings", { id: serial("id").primaryKey(), - projectId: integer("project_id").notNull().references(() => projects.id), // 프로젝트 ID 참조 codeGroupId: integer("code_group_id").notNull().references(() => codeGroups.id), // Code Group과 연결 code: varchar("code", { length: 50 }).notNull(), // CODE (예: 100, 201, 202) description: varchar("description", { length: 200 }).notNull(), // Description (예: General, Feed Gas Reveive) @@ -81,9 +80,8 @@ export const comboBoxSettings = pgTable("combo_box_settings", { updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(), }, (table) => { return { - // 같은 프로젝트 내에서 codeGroupId와 code 조합은 유니크해야 함 - uniqueProjectCodeGroupCode: unique("unique_project_code_group_code").on( - table.projectId, + // 같은 codeGroupId 내에서 code는 유니크해야 함 + uniqueCodeGroupCode: unique("unique_code_group_code").on( table.codeGroupId, table.code ), @@ -112,7 +110,6 @@ export const documentNumberTypes = pgTable("document_number_types", { // ===== Document Number Type Configs 테이블 ===== export const documentNumberTypeConfigs = pgTable("document_number_type_configs", { id: serial("id").primaryKey(), - projectId: integer("project_id").notNull().references(() => projects.id), // 프로젝트 ID 참조 documentNumberTypeId: integer("document_number_type_id").notNull().references(() => documentNumberTypes.id), codeGroupId: integer("code_group_id").references(() => codeGroups.id), // Code Group 참조 sdq: integer("sdq").notNull(), // 순서 번호 (1, 2, 3, 4, 5, 6) @@ -123,9 +120,8 @@ export const documentNumberTypeConfigs = pgTable("document_number_type_configs", updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(), }, (table) => { return { - // 같은 프로젝트 내에서 documentNumberTypeId와 sdq 조합은 유니크해야 함 - uniqueProjectNumberTypeSdq: unique("unique_project_number_type_sdq").on( - table.projectId, + // 같은 documentNumberTypeId 내에서 sdq는 유니크해야 함 + uniqueDocumentNumberTypeSdq: unique("unique_document_number_type_sdq").on( table.documentNumberTypeId, table.sdq ), @@ -138,9 +134,7 @@ export const documentNumberTypeConfigs = pgTable("document_number_type_configs", export const projectsRelations = relations(projects, ({ many }) => ({ codeGroups: many(codeGroups), documentClasses: many(documentClasses), - comboBoxSettings: many(comboBoxSettings), documentNumberTypes: many(documentNumberTypes), - documentNumberTypeConfigs: many(documentNumberTypeConfigs), })) // Code Groups 관계 @@ -177,10 +171,6 @@ export const documentClassOptionsRelations = relations(documentClassOptions, ({ // ComboBox Settings 관계 export const comboBoxSettingsRelations = relations(comboBoxSettings, ({ one }) => ({ - project: one(projects, { - fields: [comboBoxSettings.projectId], - references: [projects.id], - }), codeGroup: one(codeGroups, { fields: [comboBoxSettings.codeGroupId], references: [codeGroups.id], @@ -198,10 +188,6 @@ export const documentNumberTypesRelations = relations(documentNumberTypes, ({ ma // Document Number Type Configs 관계 export const documentNumberTypeConfigsRelations = relations(documentNumberTypeConfigs, ({ one }) => ({ - project: one(projects, { - fields: [documentNumberTypeConfigs.projectId], - references: [projects.id], - }), documentNumberType: one(documentNumberTypes, { fields: [documentNumberTypeConfigs.documentNumberTypeId], references: [documentNumberTypes.id], |
