made subregions unique to regions
All checks were successful
Vercel Production Deployment / Deploy-Production (push) Successful in 1m27s

This commit is contained in:
christian 2024-06-02 09:27:40 +02:00
parent 14b14f9f26
commit c90eedcabd

View File

@ -82,11 +82,17 @@ export const winesRelations = relations(wines, ({ one }) => ({
}), }),
})); }));
export const subRegions = createTable("subRegion", { export const subRegions = createTable(
"subRegion",
{
id: uuid("id").primaryKey().notNull().defaultRandom(), id: uuid("id").primaryKey().notNull().defaultRandom(),
name: text("name").notNull().unique(), name: text("name").notNull().unique(),
regionId: uuid("regionId").notNull(), regionId: uuid("regionId").notNull(),
}); },
(t) => ({
uniqueSubRegion: unique().on(t.name, t.regionId),
}),
);
export const subRegionsRelations = relations(subRegions, ({ many, one }) => ({ export const subRegionsRelations = relations(subRegions, ({ many, one }) => ({
wines: many(wines), wines: many(wines),