Compare commits

..

No commits in common. "29b09848b0332ea95680445443c66937a9e59980" and "753f09da32278f7ef9e1bffaa3fa3a1c81cf4561" have entirely different histories.

View File

@ -21,9 +21,7 @@ export const producers = createTable(
name: text("name").notNull().unique(),
description: text("description"),
imageUrl: text("imageUrl"),
countryId: uuid("countryId")
.references(() => countries.id, { onDelete: "cascade" })
.notNull(),
countryId: uuid("countryId").notNull(),
createdAt: timestamp("createdAt").defaultNow().notNull(),
updatedAt: timestamp("updatedAt").defaultNow(),
},
@ -54,9 +52,7 @@ export const wines = createTable("wine", {
type: typeEnum("type").notNull(),
description: text("description"),
imageUrl: text("imageUrl"),
producerId: uuid("producerId")
.references(() => producers.id, { onDelete: "cascade" })
.notNull(),
producerId: uuid("producerId").notNull(),
subRegionId: uuid("subRegionId"),
regionId: uuid("regionId").notNull(),
countryId: uuid("countryId").notNull(),
@ -91,9 +87,7 @@ export const subRegions = createTable(
{
id: uuid("id").primaryKey().notNull().defaultRandom(),
name: text("name").notNull().unique(),
regionId: uuid("regionId")
.references(() => regions.id, { onDelete: "cascade" })
.notNull(),
regionId: uuid("regionId").notNull(),
},
(t) => ({
uniqueSubRegion: unique().on(t.name, t.regionId),
@ -113,9 +107,7 @@ export const regions = createTable(
{
id: uuid("id").primaryKey().notNull().defaultRandom(),
name: text("name").notNull(),
countryId: uuid("countryId")
.references(() => countries.id, { onDelete: "cascade" })
.notNull(),
countryId: uuid("countryId").notNull(),
},
(t) => ({
uniqueRegion: unique().on(t.name, t.countryId),