summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-05-29 05:17:13 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-05-29 05:17:13 +0000
commit37f55540833c2d5894513eca9fc8f7c6233fc2d2 (patch)
tree6807978e7150358b3444c33b825c83e2c9cda8e8 /db
parent4b9bdb29e637f67761beb2db7f75dab0432d6712 (diff)
(대표님) 0529 14시 16분 변경사항 저장 (Vendor Data, Docu)
Diffstat (limited to 'db')
-rw-r--r--db/schema/vendorData.ts24
1 files changed, 23 insertions, 1 deletions
diff --git a/db/schema/vendorData.ts b/db/schema/vendorData.ts
index 20025dc0..16ae87d9 100644
--- a/db/schema/vendorData.ts
+++ b/db/schema/vendorData.ts
@@ -11,7 +11,7 @@ import {
primaryKey,
foreignKey,
pgView,
- boolean
+ boolean, index
} from "drizzle-orm/pg-core"
import { relations, and, eq, sql} from "drizzle-orm";
@@ -199,6 +199,28 @@ export const tagClasses = pgTable("tag_classes", {
};
})
+export const tagClassAttributes = pgTable("tag_class_attributes", {
+ id: integer("id").primaryKey().generatedAlwaysAsIdentity(),
+ tagClassId: integer("tag_class_id")
+ .notNull()
+ .references(() => tagClasses.id, { onDelete: "cascade" }),
+ attId: varchar("att_id", { length: 50 }).notNull(),
+ defVal: text("def_val"),
+ uomId: varchar("uom_id", { length: 50 }),
+ seq: integer("seq").default(0),
+ createdAt: timestamp("created_at").defaultNow().notNull(),
+ updatedAt: timestamp("updated_at").defaultNow().notNull(),
+}, (table) => {
+ return {
+ // 같은 tagClass 내에서 attId는 유니크해야 함
+ uniqAttIdInTagClass: unique("uniq_att_id_in_tag_class").on(
+ table.tagClassId,
+ table.attId
+ ),
+ // 순서 인덱스
+ seqIdx: index("tag_class_attributes_seq_idx").on(table.seq)
+ };
+});
// tagTypeClassFormMappings에 projectId 추가
export const tagTypeClassFormMappings = pgTable("tag_type_class_form_mappings", {
id: serial("id").primaryKey(),