diff options
Diffstat (limited to 'db')
| -rw-r--r-- | db/schema/docu-list-rule.ts | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/db/schema/docu-list-rule.ts b/db/schema/docu-list-rule.ts index 62a770b4..0d1f668a 100644 --- a/db/schema/docu-list-rule.ts +++ b/db/schema/docu-list-rule.ts @@ -28,21 +28,15 @@ export const codeGroups = pgTable("code_groups", { export const documentClasses = pgTable("document_classes", { id: serial("id").primaryKey(), projectId: integer("project_id").notNull().references(() => projects.id), // 프로젝트 ID 참조 - code: varchar("code", { length: 50 }).notNull(), // CODE (자동 생성) - value: varchar("value", { length: 100 }), // 사용자가 선택할 수 있는 값 - description: varchar("description", { length: 200 }).notNull(), // 값의 의미 설명 + value: varchar("value", { length: 1 }).notNull(), // Document Class 값 (A-Z, 0-9 중 1자리) + description: varchar("description", { length: 200 }), // 값의 설명 (선택사항) codeGroupId: integer("code_group_id").references(() => codeGroups.id), // 참조하는 Code Group ID isActive: boolean("is_active").default(true), createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(), updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(), }, (table) => { return { - // 같은 프로젝트 내에서 code는 유니크해야 함 - uniqueProjectCode: unique("unique_project_code").on( - table.projectId, - table.code - ), - // 같은 프로젝트 내에서 value는 유니크해야 함 (null 제외) + // 같은 프로젝트 내에서 value는 유니크해야 함 uniqueProjectValue: unique("unique_project_value").on( table.projectId, table.value |
