diff options
Diffstat (limited to 'db/schema')
| -rw-r--r-- | db/schema/agreementComments.ts | 2 | ||||
| -rw-r--r-- | db/schema/bidding.ts | 6 | ||||
| -rw-r--r-- | db/schema/vendorData.ts | 87 |
3 files changed, 93 insertions, 2 deletions
diff --git a/db/schema/agreementComments.ts b/db/schema/agreementComments.ts index 56631b1f..d7bbd2cb 100644 --- a/db/schema/agreementComments.ts +++ b/db/schema/agreementComments.ts @@ -38,6 +38,8 @@ export const agreementComments = pgTable('agreement_comments', { // 상태 관리 isDeleted: boolean('is_deleted').notNull().default(false), + isSubmitted: boolean('is_submitted').notNull().default(false), // 제출 여부 + submittedAt: timestamp('submitted_at'), // 제출 일시 // 감사 정보 createdAt: timestamp('created_at').defaultNow().notNull(), diff --git a/db/schema/bidding.ts b/db/schema/bidding.ts index bc31f6de..cc79f482 100644 --- a/db/schema/bidding.ts +++ b/db/schema/bidding.ts @@ -50,7 +50,8 @@ export const biddingStatusEnum = pgEnum('bidding_status', [ 'rebidding', // 재입찰 'disposal_cancelled', // 유찰취소 'bid_closure', // 폐찰 - 'round_increase' // 차수증가 + 'round_increase', // 차수증가 + 'deleted' // 삭제 ]) // 2. 계약구분 enum @@ -699,7 +700,8 @@ export const biddingStatusLabels = { rebidding: '입찰종료-재입찰', disposal_cancelled: '유찰취소', bid_closure: '폐찰', - round_increase: '입찰종료-차수증가' + round_increase: '입찰종료-차수증가', + deleted: '삭제' } as const export const contractTypeLabels = { diff --git a/db/schema/vendorData.ts b/db/schema/vendorData.ts index c3df6b53..5301e61a 100644 --- a/db/schema/vendorData.ts +++ b/db/schema/vendorData.ts @@ -41,6 +41,27 @@ export const forms = pgTable("forms", { } }) +export const formsPlant = pgTable("forms_plant", { + id: integer("id").primaryKey().generatedAlwaysAsIdentity(), + projectCode: varchar("project_code", { length: 100 }).notNull(), + packageCode: varchar("package_code", { length: 100 }).notNull(), + formCode: varchar("form_code", { length: 100 }).notNull(), + formName: varchar("form_name", { length: 255 }).notNull(), + // source: varchar("source", { length: 255 }), + // 새로 추가된 칼럼: eng와 im + eng: boolean("eng").default(false).notNull(), + im: boolean("im").default(false).notNull(), + createdAt: timestamp("created_at").defaultNow().notNull(), + updatedAt: timestamp("updated_at").defaultNow().notNull(), +}, (table) => { + return { + projectItemFormCodeUnique: uniqueIndex("project_item_form_code_unique").on( + table.projectCode, + table.formCode + ), + } +}) + // formMetas에 projectId 추가 export const formMetas = pgTable("form_metas", { id: serial("id").primaryKey(), @@ -73,6 +94,16 @@ export const formEntries = pgTable("form_entries", { updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(), }) +export const formEntriesPlant = pgTable("form_entries_plant", { + id: serial("id").primaryKey(), + formCode: varchar("form_code", { length: 50 }).notNull(), + data: jsonb("data").notNull(), + projectCode: varchar("project_code", { length: 100 }).notNull(), + packageCode: varchar("package_code", { length: 100 }).notNull(), + createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(), + updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(), +}) + export const tags = pgTable("tags", { id: integer("id").primaryKey().generatedAlwaysAsIdentity(), contractItemId: integer("contract_item_id") @@ -108,6 +139,42 @@ export const tags = pgTable("tags", { }; }); + +export const tagsPlant = pgTable("tags_plant", { + id: integer("id").primaryKey().generatedAlwaysAsIdentity(), + + // SEDP에서 오는 고유 식별자 + tagIdx: varchar("tag_idx", { length: 100 }).notNull(), + + // 사용자가 편집 가능한 태그 번호 + tagNo: varchar("tag_no", { length: 100 }).notNull(), + + tagType: varchar("tag_type", { length: 50 }).notNull(), + class: varchar("class", { length: 100 }).notNull(), + tagClassId: integer("tag_class_id") + .references(() => tagClasses.id, { onDelete: "set null" }), + description: text("description"), + + // 동적 속성을 저장할 JSONB 컬럼 추가 + attributes: jsonb("attributes").$type<Record<string, string>>(), + + createdAt: timestamp("created_at").defaultNow().notNull(), + updatedAt: timestamp("updated_at").defaultNow().notNull(), + + projectCode: varchar("project_code", { length: 100 }).notNull(), + packageCode: varchar("package_code", { length: 100 }).notNull(), + formId: integer("form_id"), + +}, (table) => { + return { + projectPackageTagIdxUnique: uniqueIndex("project_package_tag_idx_unique").on( + table.projectCode, + table.packageCode, + table.tagIdx + ), + } +}) + // tagTypes에 projectId 추가 및 복합 기본키 생성 export const tagTypes = pgTable("tag_types", { code: varchar("code", { length: 50 }).notNull(), @@ -334,6 +401,26 @@ export const vendorDataReportTemps = pgTable("vendor_data_report_temps", { export type VendorDataReportTemps = typeof vendorDataReportTemps.$inferSelect; +export const vendorDataReportTempsPlant = pgTable("vendor_data_report_temps_plant", { + id: serial("id").primaryKey(), + + projectCode: varchar("project_code", { length: 100 }).notNull(), + packageCode: varchar("package_code", { length: 100 }).notNull(), + formId: integer("form_id") + .notNull() + .references(() => forms.id, { onDelete: "cascade" }), + fileName: varchar("file_name", { length: 255 }).notNull(), + filePath: varchar("file_path", { length: 1024 }).notNull(), + createdAt: timestamp("created_at", { withTimezone: true }) + .defaultNow() + .notNull(), + updatedAt: timestamp("updated_at", { withTimezone: true }) + .defaultNow() + .notNull(), +}); + +export type VendorDataReportTempsPlant = typeof vendorDataReportTempsPlant.$inferSelect; + export const formListsView = pgView("form_lists_view").as((qb) => { return qb |
