diff --git a/migrations/0014_wet_wong.sql b/migrations/0014_wet_wong.sql new file mode 100644 index 0000000..203285b --- /dev/null +++ b/migrations/0014_wet_wong.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelCountryRegions" ALTER COLUMN "id" SET DATA TYPE varchar; \ No newline at end of file diff --git a/migrations/0015_nappy_spot.sql b/migrations/0015_nappy_spot.sql new file mode 100644 index 0000000..fdc5115 --- /dev/null +++ b/migrations/0015_nappy_spot.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelCountryRegions" ADD CONSTRAINT "worldTravelCountryRegions_id_unique" UNIQUE("id"); \ No newline at end of file diff --git a/migrations/meta/0014_snapshot.json b/migrations/meta/0014_snapshot.json new file mode 100644 index 0000000..20f4015 --- /dev/null +++ b/migrations/meta/0014_snapshot.json @@ -0,0 +1,319 @@ +{ + "id": "9570801b-297b-432f-bfb0-26e00e378f8d", + "prevId": "09cc6e72-191b-4579-ad62-e24dbc03bacf", + "version": "5", + "dialect": "pg", + "tables": { + "featuredAdventures": { + "name": "featuredAdventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "featuredAdventures_name_unique": { + "name": "featuredAdventures_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + } + }, + "session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "sharedAdventures": { + "name": "sharedAdventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "data": { + "name": "data", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hashed_password": { + "name": "hashed_password", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "userVisitedAdventures": { + "name": "userVisitedAdventures", + "schema": "", + "columns": { + "adventure_id": { + "name": "adventure_id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventure_name": { + "name": "adventure_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visited_date": { + "name": "visited_date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userVisitedAdventures_user_id_user_id_fk": { + "name": "userVisitedAdventures_user_id_user_id_fk", + "tableFrom": "userVisitedAdventures", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelCountries": { + "name": "worldTravelCountries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "continent": { + "name": "continent", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "worldTravelCountries_country_code_unique": { + "name": "worldTravelCountries_country_code_unique", + "nullsNotDistinct": false, + "columns": [ + "country_code" + ] + } + } + }, + "worldTravelCountryRegions": { + "name": "worldTravelCountryRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk": { + "name": "worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk", + "tableFrom": "worldTravelCountryRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_code" + ], + "columnsTo": [ + "country_code" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "worldTravelCountryRegions_name_unique": { + "name": "worldTravelCountryRegions_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + } + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/migrations/meta/0015_snapshot.json b/migrations/meta/0015_snapshot.json new file mode 100644 index 0000000..b455656 --- /dev/null +++ b/migrations/meta/0015_snapshot.json @@ -0,0 +1,326 @@ +{ + "id": "08e82a7f-26df-4a30-a7d0-8e6043a2de43", + "prevId": "9570801b-297b-432f-bfb0-26e00e378f8d", + "version": "5", + "dialect": "pg", + "tables": { + "featuredAdventures": { + "name": "featuredAdventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "featuredAdventures_name_unique": { + "name": "featuredAdventures_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + } + }, + "session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "sharedAdventures": { + "name": "sharedAdventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "data": { + "name": "data", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hashed_password": { + "name": "hashed_password", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "userVisitedAdventures": { + "name": "userVisitedAdventures", + "schema": "", + "columns": { + "adventure_id": { + "name": "adventure_id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventure_name": { + "name": "adventure_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visited_date": { + "name": "visited_date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userVisitedAdventures_user_id_user_id_fk": { + "name": "userVisitedAdventures_user_id_user_id_fk", + "tableFrom": "userVisitedAdventures", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelCountries": { + "name": "worldTravelCountries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "continent": { + "name": "continent", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "worldTravelCountries_country_code_unique": { + "name": "worldTravelCountries_country_code_unique", + "nullsNotDistinct": false, + "columns": [ + "country_code" + ] + } + } + }, + "worldTravelCountryRegions": { + "name": "worldTravelCountryRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk": { + "name": "worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk", + "tableFrom": "worldTravelCountryRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_code" + ], + "columnsTo": [ + "country_code" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "worldTravelCountryRegions_id_unique": { + "name": "worldTravelCountryRegions_id_unique", + "nullsNotDistinct": false, + "columns": [ + "id" + ] + }, + "worldTravelCountryRegions_name_unique": { + "name": "worldTravelCountryRegions_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + } + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/migrations/meta/_journal.json b/migrations/meta/_journal.json index 4a13db2..b703e7c 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -99,6 +99,20 @@ "when": 1712886259872, "tag": "0013_high_unicorn", "breakpoints": true + }, + { + "idx": 14, + "version": "5", + "when": 1712928449165, + "tag": "0014_wet_wong", + "breakpoints": true + }, + { + "idx": 15, + "version": "5", + "when": 1712928491810, + "tag": "0015_nappy_spot", + "breakpoints": true } ] } \ No newline at end of file diff --git a/sql/002_us.sql b/sql/002_us.sql index 4b6f706..aef770c 100644 --- a/sql/002_us.sql +++ b/sql/002_us.sql @@ -1,54 +1,53 @@ -INSERT INTO "worldTravelCountryRegions" (name, country_code) +INSERT INTO "worldTravelCountryRegions" (id, name, country_code) VALUES - ('Alabama', 'us'), - ('Alaska', 'us'), - ('Arizona', 'us'), - ('Arkansas', 'us'), - ('California', 'us'), - ('Colorado', 'us'), - ('Connecticut', 'us'), - ('Delaware', 'us'), - ('Florida', 'us'), - ('Georgia', 'us'), - ('Hawaii', 'us'), - ('Idaho', 'us'), - ('Illinois', 'us'), - ('Indiana', 'us'), - ('Iowa', 'us'), - ('Kansas', 'us'), - ('Kentucky', 'us'), - ('Louisiana', 'us'), - ('Maine', 'us'), - ('Maryland', 'us'), - ('Massachusetts', 'us'), - ('Michigan', 'us'), - ('Minnesota', 'us'), - ('Mississippi', 'us'), - ('Missouri', 'us'), - ('Montana', 'us'), - ('Nebraska', 'us'), - ('Nevada', 'us'), - ('New Hampshire', 'us'), - ('New Jersey', 'us'), - ('New Mexico', 'us'), - ('New York', 'us'), - ('North Carolina', 'us'), - ('North Dakota', 'us'), - ('Ohio', 'us'), - ('Oklahoma', 'us'), - ('Oregon', 'us'), - ('Pennsylvania', 'us'), - ('Rhode Island', 'us'), - ('South Carolina', 'us'), - ('South Dakota', 'us'), - ('Tennessee', 'us'), - ('Texas', 'us'), - ('Utah', 'us'), - ('Vermont', 'us'), - ('Virginia', 'us'), - ('Washington', 'us'), - ('West Virginia', 'us'), - ('Wisconsin', 'us'), - ('Wyoming', 'us') - -ON CONFLICT (name) DO NOTHING; + ('US-AL', 'Alabama', 'us'), + ('US-AK', 'Alaska', 'us'), + ('US-AZ', 'Arizona', 'us'), + ('US-AR', 'Arkansas', 'us'), + ('US-CA', 'California', 'us'), + ('US-CO', 'Colorado', 'us'), + ('US-CT', 'Connecticut', 'us'), + ('US-DE', 'Delaware', 'us'), + ('US-FL', 'Florida', 'us'), + ('US-GA', 'Georgia', 'us'), + ('US-HI', 'Hawaii', 'us'), + ('US-ID', 'Idaho', 'us'), + ('US-IL', 'Illinois', 'us'), + ('US-IN', 'Indiana', 'us'), + ('US-IA', 'Iowa', 'us'), + ('US-KS', 'Kansas', 'us'), + ('US-KY', 'Kentucky', 'us'), + ('US-LA', 'Louisiana', 'us'), + ('US-ME', 'Maine', 'us'), + ('US-MD', 'Maryland', 'us'), + ('US-MA', 'Massachusetts', 'us'), + ('US-MI', 'Michigan', 'us'), + ('US-MN', 'Minnesota', 'us'), + ('US-MS', 'Mississippi', 'us'), + ('US-MO', 'Missouri', 'us'), + ('US-MT', 'Montana', 'us'), + ('US-NE', 'Nebraska', 'us'), + ('US-NV', 'Nevada', 'us'), + ('US-NH', 'New Hampshire', 'us'), + ('US-NJ', 'New Jersey', 'us'), + ('US-NM', 'New Mexico', 'us'), + ('US-NY', 'New York', 'us'), + ('US-NC', 'North Carolina', 'us'), + ('US-ND', 'North Dakota', 'us'), + ('US-OH', 'Ohio', 'us'), + ('US-OK', 'Oklahoma', 'us'), + ('US-OR', 'Oregon', 'us'), + ('US-PA', 'Pennsylvania', 'us'), + ('US-RI', 'Rhode Island', 'us'), + ('US-SC', 'South Carolina', 'us'), + ('US-SD', 'South Dakota', 'us'), + ('US-TN', 'Tennessee', 'us'), + ('US-TX', 'Texas', 'us'), + ('US-UT', 'Utah', 'us'), + ('US-VT', 'Vermont', 'us'), + ('US-VA', 'Virginia', 'us'), + ('US-WA', 'Washington', 'us'), + ('US-WV', 'West Virginia', 'us'), + ('US-WI', 'Wisconsin', 'us'), + ('US-WY', 'Wyoming', 'us') +ON CONFLICT (id) DO NOTHING; diff --git a/sql/003_ca.sql b/sql/003_ca.sql index 7fc2869..14c777d 100644 --- a/sql/003_ca.sql +++ b/sql/003_ca.sql @@ -1,17 +1,16 @@ -INSERT INTO "worldTravelCountryRegions" (name, country_code) +INSERT INTO "worldTravelCountryRegions" (id, name, country_code) VALUES - ('Alberta', 'ca'), - ('British Columbia', 'ca'), - ('Manitoba', 'ca'), - ('New Brunswick', 'ca'), - ('Newfoundland and Labrador', 'ca'), - ('Nova Scotia', 'ca'), - ('Ontario', 'ca'), - ('Prince Edward Island', 'ca'), - ('Quebec', 'ca'), - ('Saskatchewan', 'ca'), - ('Northwest Territories', 'ca'), - ('Nunavut', 'ca'), - ('Yukon', 'ca') - -ON CONFLICT (name) DO NOTHING; + ('CA-AB', 'Alberta', 'ca'), + ('CA-BC', 'British Columbia', 'ca'), + ('CA-MB', 'Manitoba', 'ca'), + ('CA-NB', 'New Brunswick', 'ca'), + ('CA-NL', 'Newfoundland and Labrador', 'ca'), + ('CA-NS', 'Nova Scotia', 'ca'), + ('CA-ON', 'Ontario', 'ca'), + ('CA-PE', 'Prince Edward Island', 'ca'), + ('CA-QC', 'Quebec', 'ca'), + ('CA-SK', 'Saskatchewan', 'ca'), + ('CA-NT', 'Northwest Territories', 'ca'), + ('CA-NU', 'Nunavut', 'ca'), + ('CA-YT', 'Yukon', 'ca') +ON CONFLICT (id) DO NOTHING; diff --git a/sql/004_de.sql b/sql/004_de.sql index 2ad9216..311f67f 100644 --- a/sql/004_de.sql +++ b/sql/004_de.sql @@ -1,20 +1,20 @@ -INSERT INTO "worldTravelCountryRegions" (name, country_code) +INSERT INTO "worldTravelCountryRegions" (id, name, country_code) VALUES - ('Baden-Württemberg', 'de'), - ('Bavaria', 'de'), - ('Berlin', 'de'), - ('Brandenburg', 'de'), - ('Bremen', 'de'), - ('Hamburg', 'de'), - ('Hesse', 'de'), - ('Lower Saxony', 'de'), - ('Mecklenburg-Vorpommern', 'de'), - ('North Rhine-Westphalia', 'de'), - ('Rhineland-Palatinate', 'de'), - ('Saarland', 'de'), - ('Saxony', 'de'), - ('Saxony-Anhalt', 'de'), - ('Schleswig-Holstein', 'de'), - ('Thuringia', 'de') + ('DE-BW', 'Baden-Württemberg', 'de'), + ('DE-BY', 'Bavaria', 'de'), + ('DE-BE', 'Berlin', 'de'), + ('DE-BB', 'Brandenburg', 'de'), + ('DE-HB', 'Bremen', 'de'), + ('DE-HH', 'Hamburg', 'de'), + ('DE-HE', 'Hesse', 'de'), + ('DE-NI', 'Lower Saxony', 'de'), + ('DE-MV', 'Mecklenburg-Vorpommern', 'de'), + ('DE-NW', 'North Rhine-Westphalia', 'de'), + ('DE-RP', 'Rhineland-Palatinate', 'de'), + ('DE-SL', 'Saarland', 'de'), + ('DE-SN', 'Saxony', 'de'), + ('DE-ST', 'Saxony-Anhalt', 'de'), + ('DE-SH', 'Schleswig-Holstein', 'de'), + ('DE-TH', 'Thuringia', 'de'); -ON CONFLICT (name) DO NOTHING; +ON CONFLICT (id) DO NOTHING; diff --git a/sql/005_fr.sql b/sql/005_fr.sql new file mode 100644 index 0000000..08cabf5 --- /dev/null +++ b/sql/005_fr.sql @@ -0,0 +1,22 @@ +INSERT INTO "worldTravelCountryRegions" (id, name, country_code) +VALUES + ('FR-ARA', 'Auvergne-Rhône-Alpes', 'fr'), + ('FR-BFC', 'Bourgogne-Franche-Comté', 'fr'), + ('FR-BRE', 'Brittany', 'fr'), + ('FR-CVL', 'Centre-Val de Loire', 'fr'), + ('FR-GES', 'Grand Est', 'fr'), + ('FR-HDF', 'Hauts-de-France', 'fr'), + ('FR-IDF', 'Île-de-France', 'fr'), + ('FR-NOR', 'Normandy', 'fr'), + ('FR-NAQ', 'Nouvelle-Aquitaine', 'fr'), + ('FR-OCC', 'Occitanie', 'fr'), + ('FR-PDL', 'Pays de la Loire', 'fr'), + ('FR-PAC', 'Provence-Alpes-Côte d''Azur', 'fr'), + ('FR-COR', 'Corsica', 'fr'), + ('FR-MQ', 'Martinique', 'fr'), + ('FR-GF', 'French Guiana', 'fr'), + ('FR-RÉ', 'Réunion', 'fr'), + ('FR-YT', 'Mayotte', 'fr'), + ('FR-GP', 'Guadeloupe', 'fr') + +ON CONFLICT (id) DO NOTHING; diff --git a/sql/006_gb.sql b/sql/006_gb.sql new file mode 100644 index 0000000..c1a0ef9 --- /dev/null +++ b/sql/006_gb.sql @@ -0,0 +1,8 @@ +INSERT INTO "worldTravelCountryRegions" (id, name, country_code) +VALUES + ('GB-ENG', 'England', 'gb'), + ('GB-NIR', 'Northern Ireland', 'gb'), + ('GB-SCT', 'Scotland', 'gb'), + ('GB-WLS', 'Wales', 'gb') + +ON CONFLICT (id) DO NOTHING; diff --git a/sql/007_ar.sql b/sql/007_ar.sql new file mode 100644 index 0000000..627335d --- /dev/null +++ b/sql/007_ar.sql @@ -0,0 +1,28 @@ +INSERT INTO "worldTravelCountryRegions" (id, name, country_code) +VALUES + ('AR-C', 'Ciudad Autónoma de Buenos Aires', 'ar'), + ('AR-B', 'Buenos Aires', 'ar'), + ('AR-K', 'Catamarca', 'ar'), + ('AR-H', 'Chaco', 'ar'), + ('AR-U', 'Chubut', 'ar'), + ('AR-W', 'Córdoba', 'ar'), + ('AR-X', 'Corrientes', 'ar'), + ('AR-E', 'Entre Ríos', 'ar'), + ('AR-P', 'Formosa', 'ar'), + ('AR-Y', 'Jujuy', 'ar'), + ('AR-L', 'La Pampa', 'ar'), + ('AR-F', 'La Rioja', 'ar'), + ('AR-M', 'Mendoza', 'ar'), + ('AR-N', 'Misiones', 'ar'), + ('AR-Q', 'Neuquén', 'ar'), + ('AR-R', 'Río Negro', 'ar'), + ('AR-A', 'Salta', 'ar'), + ('AR-J', 'San Juan', 'ar'), + ('AR-D', 'San Luis', 'ar'), + ('AR-Z', 'Santa Cruz', 'ar'), + ('AR-S', 'Santa Fe', 'ar'), + ('AR-G', 'Santiago del Estero', 'ar'), + ('AR-V', 'Tierra del Fuego', 'ar'), + ('AR-T', 'Tucumán', 'ar') + +ON CONFLICT (id) DO NOTHING; diff --git a/sql/008_mx.sql b/sql/008_mx.sql new file mode 100644 index 0000000..4f57691 --- /dev/null +++ b/sql/008_mx.sql @@ -0,0 +1,35 @@ +INSERT INTO "worldTravelCountryRegions" (id, name, country_code) +VALUES + ('MX-AGU', 'Aguascalientes', 'mx'), + ('MX-BCN', 'Baja California', 'mx'), + ('MX-BCS', 'Baja California Sur', 'mx'), + ('MX-CAM', 'Campeche', 'mx'), + ('MX-CHP', 'Chiapas', 'mx'), + ('MX-CHH', 'Chihuahua', 'mx'), + ('MX-COA', 'Coahuila', 'mx'), + ('MX-COL', 'Colima', 'mx'), + ('MX-DUR', 'Durango', 'mx'), + ('MX-GUA', 'Guanajuato', 'mx'), + ('MX-GRO', 'Guerrero', 'mx'), + ('MX-HID', 'Hidalgo', 'mx'), + ('MX-JAL', 'Jalisco', 'mx'), + ('MX-MEX', 'State of Mexico', 'mx'), + ('MX-MIC', 'Michoacán', 'mx'), + ('MX-MOR', 'Morelos', 'mx'), + ('MX-NAY', 'Nayarit', 'mx'), + ('MX-NLE', 'Nuevo León', 'mx'), + ('MX-OAX', 'Oaxaca', 'mx'), + ('MX-PUE', 'Puebla', 'mx'), + ('MX-QUE', 'Querétaro', 'mx'), + ('MX-ROO', 'Quintana Roo', 'mx'), + ('MX-SLP', 'San Luis Potosí', 'mx'), + ('MX-SIN', 'Sinaloa', 'mx'), + ('MX-SON', 'Sonora', 'mx'), + ('MX-TAB', 'Tabasco', 'mx'), + ('MX-TAM', 'Tamaulipas', 'mx'), + ('MX-TLA', 'Tlaxcala', 'mx'), + ('MX-VER', 'Veracruz', 'mx'), + ('MX-YUC', 'Yucatán', 'mx'), + ('MX-ZAC', 'Zacatecas', 'mx') + +ON CONFLICT (id) DO NOTHING; diff --git a/sql/009_jp.sql b/sql/009_jp.sql new file mode 100644 index 0000000..dda90b9 --- /dev/null +++ b/sql/009_jp.sql @@ -0,0 +1,51 @@ +INSERT INTO "worldTravelCountryRegions" (id, name, country_code) +VALUES + ('JP-01', 'Hokkaido', 'jp'), + ('JP-02', 'Aomori', 'jp'), + ('JP-03', 'Iwate', 'jp'), + ('JP-04', 'Miyagi', 'jp'), + ('JP-05', 'Akita', 'jp'), + ('JP-06', 'Yamagata', 'jp'), + ('JP-07', 'Fukushima', 'jp'), + ('JP-08', 'Ibaraki', 'jp'), + ('JP-09', 'Tochigi', 'jp'), + ('JP-10', 'Gunma', 'jp'), + ('JP-11', 'Saitama', 'jp'), + ('JP-12', 'Chiba', 'jp'), + ('JP-13', 'Tokyo', 'jp'), + ('JP-14', 'Kanagawa', 'jp'), + ('JP-15', 'Niigata', 'jp'), + ('JP-16', 'Toyama', 'jp'), + ('JP-17', 'Ishikawa', 'jp'), + ('JP-18', 'Fukui', 'jp'), + ('JP-19', 'Yamanashi', 'jp'), + ('JP-20', 'Nagano', 'jp'), + ('JP-21', 'Gifu', 'jp'), + ('JP-22', 'Shizuoka', 'jp'), + ('JP-23', 'Aichi', 'jp'), + ('JP-24', 'Mie', 'jp'), + ('JP-25', 'Shiga', 'jp'), + ('JP-26', 'Kyoto', 'jp'), + ('JP-27', 'Osaka', 'jp'), + ('JP-28', 'Hyogo', 'jp'), + ('JP-29', 'Nara', 'jp'), + ('JP-30', 'Wakayama', 'jp'), + ('JP-31', 'Tottori', 'jp'), + ('JP-32', 'Shimane', 'jp'), + ('JP-33', 'Okayama', 'jp'), + ('JP-34', 'Hiroshima', 'jp'), + ('JP-35', 'Yamaguchi', 'jp'), + ('JP-36', 'Tokushima', 'jp'), + ('JP-37', 'Kagawa', 'jp'), + ('JP-38', 'Ehime', 'jp'), + ('JP-39', 'Kochi', 'jp'), + ('JP-40', 'Fukuoka', 'jp'), + ('JP-41', 'Saga', 'jp'), + ('JP-42', 'Nagasaki', 'jp'), + ('JP-43', 'Kumamoto', 'jp'), + ('JP-44', 'Oita', 'jp'), + ('JP-45', 'Miyazaki', 'jp'), + ('JP-46', 'Kagoshima', 'jp'), + ('JP-47', 'Okinawa', 'jp') + +ON CONFLICT (id) DO NOTHING; diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index 3ecc8bc..2dc3661 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -5,7 +5,6 @@ import { json, serial, varchar, - foreignKey, integer, } from "drizzle-orm/pg-core"; @@ -62,7 +61,7 @@ export const worldTravelCountries = pgTable("worldTravelCountries", { }); export const worldTravelCountryRegions = pgTable("worldTravelCountryRegions", { - id: serial("id").primaryKey(), + id: varchar("id").primaryKey().unique(), name: text("name").notNull().unique(), country_code: text("country_code") .notNull()