feat: migrate globalItems — drop brand text, add manufacturerId FK
This commit is contained in:
@@ -177,7 +177,9 @@ export const globalItems = pgTable(
|
||||
"global_items",
|
||||
{
|
||||
id: serial("id").primaryKey(),
|
||||
brand: text("brand").notNull(),
|
||||
manufacturerId: integer("manufacturer_id")
|
||||
.notNull()
|
||||
.references(() => manufacturers.id),
|
||||
model: text("model").notNull(),
|
||||
category: text("category"),
|
||||
weightGrams: doublePrecision("weight_grams"),
|
||||
@@ -193,7 +195,7 @@ export const globalItems = pgTable(
|
||||
cropY: doublePrecision("crop_y"),
|
||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||
},
|
||||
(table) => [unique().on(table.brand, table.model)],
|
||||
(table) => [unique().on(table.manufacturerId, table.model)],
|
||||
);
|
||||
|
||||
// ── Tags ───────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user