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