1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-05 13:15:18 +02:00

Add country regions for Germany, South Africa, Australia, New Zealand, Egypt, Brazil, China

This commit is contained in:
Sean Morley 2024-04-12 14:04:23 +00:00
parent 3887ac845e
commit 61458b3cc2
12 changed files with 510 additions and 2 deletions

View file

@ -0,0 +1 @@
ALTER TABLE "worldTravelCountryRegions" DROP CONSTRAINT "worldTravelCountryRegions_name_unique";

View file

@ -0,0 +1,319 @@
{
"id": "4ec66da5-6bf4-41ac-b998-95f1e14a5372",
"prevId": "08e82a7f-26df-4a30-a7d0-8e6043a2de43",
"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"
]
}
}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -113,6 +113,13 @@
"when": 1712928491810,
"tag": "0015_nappy_spot",
"breakpoints": true
},
{
"idx": 16,
"version": "5",
"when": 1712930531576,
"tag": "0016_curvy_purple_man",
"breakpoints": true
}
]
}

View file

@ -15,6 +15,6 @@ VALUES
('DE-SN', 'Saxony', 'de'),
('DE-ST', 'Saxony-Anhalt', 'de'),
('DE-SH', 'Schleswig-Holstein', 'de'),
('DE-TH', 'Thuringia', 'de');
('DE-TH', 'Thuringia', 'de')
ON CONFLICT (id) DO NOTHING;

35
sql/010_cn.sql Normal file
View file

@ -0,0 +1,35 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('CN-BJ', 'Beijing', 'cn'),
('CN-TJ', 'Tianjin', 'cn'),
('CN-HE', 'Hebei', 'cn'),
('CN-SX', 'Shanxi', 'cn'),
('CN-NM', 'Inner Mongolia', 'cn'),
('CN-LN', 'Liaoning', 'cn'),
('CN-JL', 'Jilin', 'cn'),
('CN-HL', 'Heilongjiang', 'cn'),
('CN-SH', 'Shanghai', 'cn'),
('CN-JS', 'Jiangsu', 'cn'),
('CN-ZJ', 'Zhejiang', 'cn'),
('CN-AH', 'Anhui', 'cn'),
('CN-FJ', 'Fujian', 'cn'),
('CN-JX', 'Jiangxi', 'cn'),
('CN-SD', 'Shandong', 'cn'),
('CN-HA', 'Henan', 'cn'),
('CN-HB', 'Hubei', 'cn'),
('CN-HN', 'Hunan', 'cn'),
('CN-GD', 'Guangdong', 'cn'),
('CN-GX', 'Guangxi', 'cn'),
('CN-HI', 'Hainan', 'cn'),
('CN-CQ', 'Chongqing', 'cn'),
('CN-SC', 'Sichuan', 'cn'),
('CN-GZ', 'Guizhou', 'cn'),
('CN-YN', 'Yunnan', 'cn'),
('CN-XZ', 'Tibet', 'cn'),
('CN-SA', 'Shaanxi', 'cn'),
('CN-GS', 'Gansu', 'cn'),
('CN-QH', 'Qinghai', 'cn'),
('CN-NX', 'Ningxia', 'cn'),
('CN-XJ', 'Xinjiang', 'cn')
ON CONFLICT (id) DO NOTHING;

39
sql/011_in.sql Normal file
View file

@ -0,0 +1,39 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('IN-AN', 'Andaman and Nicobar Islands', 'in'),
('IN-AP', 'Andhra Pradesh', 'in'),
('IN-AR', 'Arunachal Pradesh', 'in'),
('IN-AS', 'Assam', 'in'),
('IN-BR', 'Bihar', 'in'),
('IN-CH', 'Chandigarh', 'in'),
('IN-CT', 'Chhattisgarh', 'in'),
('IN-DN', 'Dadra and Nagar Haveli and Daman and Diu', 'in'),
('IN-DD', 'Daman and Diu', 'in'), -- These IDs are consolidated now, but adding separately for compatibility
('IN-DL', 'Delhi', 'in'),
('IN-GA', 'Goa', 'in'),
('IN-GJ', 'Gujarat', 'in'),
('IN-HR', 'Haryana', 'in'),
('IN-HP', 'Himachal Pradesh', 'in'),
('IN-JH', 'Jharkhand', 'in'),
('IN-KA', 'Karnataka', 'in'),
('IN-KL', 'Kerala', 'in'),
('IN-LD', 'Lakshadweep', 'in'),
('IN-MP', 'Madhya Pradesh', 'in'),
('IN-MH', 'Maharashtra', 'in'),
('IN-MN', 'Manipur', 'in'),
('IN-ML', 'Meghalaya', 'in'),
('IN-MZ', 'Mizoram', 'in'),
('IN-NL', 'Nagaland', 'in'),
('IN-OR', 'Odisha', 'in'),
('IN-PY', 'Puducherry', 'in'),
('IN-PB', 'Punjab', 'in'),
('IN-RJ', 'Rajasthan', 'in'),
('IN-SK', 'Sikkim', 'in'),
('IN-TN', 'Tamil Nadu', 'in'),
('IN-TG', 'Telangana', 'in'),
('IN-TR', 'Tripura', 'in'),
('IN-UP', 'Uttar Pradesh', 'in'),
('IN-UT', 'Uttarakhand', 'in'),
('IN-WB', 'West Bengal', 'in')
ON CONFLICT (id) DO NOTHING;

12
sql/012_au.sql Normal file
View file

@ -0,0 +1,12 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('AU-NSW', 'New South Wales', 'au'),
('AU-VIC', 'Victoria', 'au'),
('AU-QLD', 'Queensland', 'au'),
('AU-SA', 'South Australia', 'au'),
('AU-WA', 'Western Australia', 'au'),
('AU-TAS', 'Tasmania', 'au'),
('AU-NT', 'Northern Territory', 'au'),
('AU-ACT', 'Australian Capital Territory', 'au')
ON CONFLICT (id) DO NOTHING;

20
sql/013_nz.sql Normal file
View file

@ -0,0 +1,20 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('NZ-N', 'Northland', 'nz'),
('NZ-AUK', 'Auckland', 'nz'),
('NZ-WKO', 'Waikato', 'nz'),
('NZ-BOP', 'Bay of Plenty', 'nz'),
('NZ-GIS', 'Gisborne', 'nz'),
('NZ-HKB', 'Hawke''s Bay', 'nz'),
('NZ-TKI', 'Taranaki', 'nz'),
('NZ-MWT', 'Manawatū-Whanganui', 'nz'),
('NZ-WGN', 'Wellington', 'nz'),
('NZ-TAS', 'Tasman', 'nz'),
('NZ-NEL', 'Nelson', 'nz'),
('NZ-MBH', 'Marlborough', 'nz'),
('NZ-WTC', 'West Coast', 'nz'),
('NZ-CAN', 'Canterbury', 'nz'),
('NZ-OTA', 'Otago', 'nz'),
('NZ-STL', 'Southland', 'nz')
ON CONFLICT (id) DO NOTHING;

13
sql/014_za.sql Normal file
View file

@ -0,0 +1,13 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('ZA-EC', 'Eastern Cape', 'za'),
('ZA-FS', 'Free State', 'za'),
('ZA-GP', 'Gauteng', 'za'),
('ZA-KZN', 'KwaZulu-Natal', 'za'),
('ZA-LP', 'Limpopo', 'za'),
('ZA-MP', 'Mpumalanga', 'za'),
('ZA-NW', 'North West', 'za'),
('ZA-NC', 'Northern Cape', 'za'),
('ZA-WC', 'Western Cape', 'za')
ON CONFLICT (id) DO NOTHING;

31
sql/015_eg.sql Normal file
View file

@ -0,0 +1,31 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('EG-ALX', 'Alexandria', 'eg'),
('EG-ASN', 'Aswan', 'eg'),
('EG-ASY', 'Asyut', 'eg'),
('EG-BHR', 'Beheira', 'eg'),
('EG-BNS', 'Beni Suef', 'eg'),
('EG-C', 'Cairo', 'eg'),
('EG-DK', 'Dakahlia', 'eg'),
('EG-DAM', 'Damietta', 'eg'),
('EG-FYM', 'Faiyum', 'eg'),
('EG-GH', 'Gharbia', 'eg'),
('EG-GZ', 'Giza', 'eg'),
('EG-IS', 'Ismailia', 'eg'),
('EG-KB', 'Kafr El Sheikh', 'eg'),
('EG-LX', 'Luxor', 'eg'),
('EG-MN', 'Minya', 'eg'),
('EG-MT', 'Matrouh', 'eg'),
('EG-QH', 'Qalyubia', 'eg'),
('EG-KFS', 'Qena', 'eg'),
('EG-SHG', 'Sohag', 'eg'),
('EG-SHR', 'Sharqia', 'eg'),
('EG-SIN', 'South Sinai', 'eg'),
('EG-SW', 'Suez', 'eg'),
('EG-WAD', 'New Valley', 'eg'),
('EG-ASD', 'North Sinai', 'eg'),
('EG-PTS', 'Port Said', 'eg'),
('EG-SKB', 'Suez', 'eg'),
('EG-ESI', 'Ismailia', 'eg')
ON CONFLICT (id) DO NOTHING;

31
sql/016_br.sql Normal file
View file

@ -0,0 +1,31 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES
('BR-AC', 'Acre', 'br'),
('BR-AL', 'Alagoas', 'br'),
('BR-AP', 'Amapá', 'br'),
('BR-AM', 'Amazonas', 'br'),
('BR-BA', 'Bahia', 'br'),
('BR-CE', 'Ceará', 'br'),
('BR-DF', 'Federal District', 'br'),
('BR-ES', 'Espírito Santo', 'br'),
('BR-GO', 'Goiás', 'br'),
('BR-MA', 'Maranhão', 'br'),
('BR-MT', 'Mato Grosso', 'br'),
('BR-MS', 'Mato Grosso do Sul', 'br'),
('BR-MG', 'Minas Gerais', 'br'),
('BR-PA', 'Pará', 'br'),
('BR-PB', 'Paraíba', 'br'),
('BR-PR', 'Paraná', 'br'),
('BR-PE', 'Pernambuco', 'br'),
('BR-PI', 'Piauí', 'br'),
('BR-RJ', 'Rio de Janeiro', 'br'),
('BR-RN', 'Rio Grande do Norte', 'br'),
('BR-RS', 'Rio Grande do Sul', 'br'),
('BR-RO', 'Rondônia', 'br'),
('BR-RR', 'Roraima', 'br'),
('BR-SC', 'Santa Catarina', 'br'),
('BR-SP', 'São Paulo', 'br'),
('BR-SE', 'Sergipe', 'br'),
('BR-TO', 'Tocantins', 'br')
ON CONFLICT (id) DO NOTHING;

View file

@ -62,7 +62,7 @@ export const worldTravelCountries = pgTable("worldTravelCountries", {
export const worldTravelCountryRegions = pgTable("worldTravelCountryRegions", {
id: varchar("id").primaryKey().unique(),
name: text("name").notNull().unique(),
name: text("name").notNull(),
country_code: text("country_code")
.notNull()
.references(() => worldTravelCountries.country_code),