feat(25-01): add attribution columns and unique constraint to globalItems

- Add sourceUrl, imageCredit, imageSourceUrl nullable columns
- Add unique constraint on (brand, model) pair
- Generate migration 0003_loving_serpent_society.sql
This commit is contained in:
2026-04-10 10:55:55 +02:00
parent b6970c9a04
commit 39ef9cc433
3 changed files with 41 additions and 11 deletions

View File

@@ -133,17 +133,24 @@ export const setupItems = pgTable("setup_items", {
// ── Global Items ────────────────────────────────────────────────────
export const globalItems = pgTable("global_items", {
id: serial("id").primaryKey(),
brand: text("brand").notNull(),
model: text("model").notNull(),
category: text("category"),
weightGrams: doublePrecision("weight_grams"),
priceCents: integer("price_cents"),
imageUrl: text("image_url"),
description: text("description"),
createdAt: timestamp("created_at").defaultNow().notNull(),
});
export const globalItems = pgTable(
"global_items",
{
id: serial("id").primaryKey(),
brand: text("brand").notNull(),
model: text("model").notNull(),
category: text("category"),
weightGrams: doublePrecision("weight_grams"),
priceCents: integer("price_cents"),
imageUrl: text("image_url"),
description: text("description"),
sourceUrl: text("source_url"),
imageCredit: text("image_credit"),
imageSourceUrl: text("image_source_url"),
createdAt: timestamp("created_at").defaultNow().notNull(),
},
(table) => [unique().on(table.brand, table.model)],
);
// ── Tags ───────────────────────────────────────────────────────────