diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-01 13:52:21 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-01 13:52:21 +0000 |
| commit | bac0228d21b7195065e9cddcc327ae33659c7bcc (patch) | |
| tree | 8f3016ae4533c8706d0c00a605d9b1d41968c2bc /db/schema/items.ts | |
| parent | 2fdce8d7a57c792bba0ac36fa554dca9c9cc31e3 (diff) | |
(대표님) 20250601까지 작업사항
Diffstat (limited to 'db/schema/items.ts')
| -rw-r--r-- | db/schema/items.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/db/schema/items.ts b/db/schema/items.ts index 4fd34506..61643759 100644 --- a/db/schema/items.ts +++ b/db/schema/items.ts @@ -4,8 +4,11 @@ import { pgTable, varchar, text, timestamp ,serial, integer, pgEnum} from "drizz // 자재 아이템 정보 테이블 (items) - 기존 CMCTB_MAT_CLAS 테이블 매핑 (SOAP 연결 시 컬럼이 추가/삭제될 수 있음) export const items = pgTable("items", { id: serial("id").primaryKey(), // 고유 식별자 (신규 추가) + ProjectNo: varchar("project_no", { length: 100 }).notNull(), // CLAS_CD - 아이템 코드 (자재 클래스 코드) itemCode: varchar("item_code", { length: 100 }).unique(), // CLAS_CD - 아이템 코드 (자재 클래스 코드) itemName: varchar("item_name", { length: 255 }).notNull(), // CLAS_NM - 아이템명 (자재 클래스명) + packageCode: varchar("package_code", { length: 255 }).notNull(), // CLAS_NM - 아이템명 (자재 클래스명) + smCode: varchar("sm_code", { length: 255 }), // CLAS_NM - 아이템명 (자재 클래스명) description: text("description"), // CLAS_DTL - 아이템 상세 설명 (클래스 내역) parentItemCode: varchar("parent_item_code", { length: 18 }), // PRNT_CLAS_CD - 부모 아이템 코드 (부모 클래스 코드) itemLevel: integer("item_level"), // CLAS_LVL - 아이템 레벨 (클래스 레벨) @@ -19,7 +22,26 @@ export const items = pgTable("items", { updatedAt: timestamp("updated_at").defaultNow().notNull(), // 수정일시 (신규 추가) }); +export const materials = pgTable("materials", { + id: serial("id").primaryKey(), // 고유 식별자 (신규 추가) + itemCode: varchar("item_code", { length: 100 }).unique(), // CLAS_CD - 아이템 코드 (자재 클래스 코드) + itemName: varchar("item_name", { length: 255 }).notNull(), // CLAS_NM - 아이템명 (자재 클래스명) + description: text("description"), // CLAS_DTL - 아이템 상세 설명 (클래스 내역) + parentItemCode: varchar("parent_item_code", { length: 18 }), // PRNT_CLAS_CD - 부모 아이템 코드 (부모 클래스 코드) + itemLevel: integer("item_level"), // CLAS_LVL - 아이템 레벨 (클래스 레벨) + deleteFlag: varchar("delete_flag", { length: 1 }), // DEL_ORDR - 삭제 지시자 (Y/N) + unitOfMeasure: varchar("unit_of_measure", { length: 3 }), // UOM - 단위 (UOM) + steelType: varchar("steel_type", { length: 2 }), // STYPE - 강종 (Steel Type) + gradeMaterial: varchar("grade_material", { length: 50 }), // GRD_MATL - 등급 재질 (Grade Material) + changeDate: varchar("change_date", { length: 8 }), // CHG_DT - 수정일자 (YYYYMMDD) + baseUnitOfMeasure: varchar("base_unit_of_measure", { length: 3 }), // BSE_UOM - 기준 단위 (Base UOM) + createdAt: timestamp("created_at").defaultNow().notNull(), // 생성일시 (신규 추가) + updatedAt: timestamp("updated_at").defaultNow().notNull(), // 수정일시 (신규 추가) +}); + + export type Item = typeof items.$inferSelect +export type Materials = typeof materials.$inferSelect export const itemsRelations = relations(items, ({ many }) => ({ shipbuilding: many(itemShipbuilding), |
