Add unique constraint to worldTravelCountries.country_code and create worldTravelCountryRegions table

This commit is contained in:
Sean Morley
2024-04-12 00:03:14 +00:00
parent a03fc5fb4e
commit d190222573
6 changed files with 599 additions and 1 deletions

View File

@@ -57,6 +57,14 @@ export const userVisitedAdventures = pgTable("userVisitedAdventures", {
export const worldTravelCountries = pgTable("worldTravelCountries", {
id: serial("id").primaryKey(),
name: text("name").notNull(),
country_code: text("country_code").notNull(),
country_code: text("country_code").notNull().unique(),
continent: text("continent").notNull(),
});
export const worldTravelCountryRegions = pgTable("worldTravelCountryRegions", {
id: serial("id").primaryKey(),
name: text("name").notNull(),
country_code: text("country_code")
.notNull()
.references(() => worldTravelCountries.country_code),
});