From af07ea29efb9218cc8b17998ceca2c42b3afe50c Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Thu, 11 Apr 2024 18:18:35 +0000 Subject: [PATCH 01/20] Refactor success toast and show appropriate messages --- src/lib/components/SucessToast.svelte | 2 +- src/routes/log/+page.svelte | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/lib/components/SucessToast.svelte b/src/lib/components/SucessToast.svelte index b7a8010..b120a9a 100644 --- a/src/lib/components/SucessToast.svelte +++ b/src/lib/components/SucessToast.svelte @@ -4,6 +4,6 @@
- Adventure {action} successfully! + {action}
diff --git a/src/routes/log/+page.svelte b/src/routes/log/+page.svelte index a4b5b8e..a15748f 100644 --- a/src/routes/log/+page.svelte +++ b/src/routes/log/+page.svelte @@ -48,12 +48,10 @@ function showToast(action: string) { toastAction = action; isShowingToast = true; - console.log("showing toast"); setTimeout(() => { isShowingToast = false; toastAction = ""; - console.log("hiding toast"); }, 3000); } @@ -87,7 +85,7 @@ ]; newName = ""; // Reset newName and newLocation after adding adventure newLocation = ""; - showToast("added"); + showToast("Adventure added successfully!"); visitCount.update((n) => n + 1); }) .catch((error) => { @@ -121,7 +119,7 @@ editName = ""; editLocation = ""; editCreated = ""; - showToast("edited"); + showToast("Adventure edited successfully!"); }) .catch((error) => { console.error("Error:", error); @@ -155,6 +153,7 @@ console.log("Success:", data); let url = window.location.origin + "/shared/" + key; navigator.clipboard.writeText(url); + showToast("Link copied to clipboard!"); }) .catch((error) => { console.error("Error:", error); @@ -180,7 +179,7 @@ console.log("Success:", data); // remove adventure from array where id matches adventures = []; - showToast("removed"); + showToast("Adventure removed successfully!"); visitCount.set(0); }) .catch((error) => { @@ -205,7 +204,7 @@ adventures = adventures.filter( (adventure) => adventure.id !== event.detail, ); - showToast("removed"); + showToast("Adventure removed successfully!"); visitCount.update((n) => n - 1); }) .catch((error) => { From 167080441a34e2c589cf8379aef6dc81c136304f Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Thu, 11 Apr 2024 21:15:34 +0000 Subject: [PATCH 02/20] Refactor AdventureCard component and shared page --- src/lib/components/AdventureCard.svelte | 28 +++++++++++++++++++++++++ src/routes/shared/[key]/+page.server.ts | 25 +++++++++++++++++++--- src/routes/shared/[key]/+page.svelte | 27 ++++++++++++++++++++++-- tailwind.config.js | 2 +- 4 files changed, 76 insertions(+), 6 deletions(-) diff --git a/src/lib/components/AdventureCard.svelte b/src/lib/components/AdventureCard.svelte index 01e296a..9146128 100644 --- a/src/lib/components/AdventureCard.svelte +++ b/src/lib/components/AdventureCard.svelte @@ -75,3 +75,31 @@ {/if} + +{#if type === "shared"} +
+
+

{name}

+ {#if location !== ""} +

+ Logo{location} +

+ {/if} + {#if created !== ""} +

+ Logo{created} +

+ {/if} +
+
+{/if} diff --git a/src/routes/shared/[key]/+page.server.ts b/src/routes/shared/[key]/+page.server.ts index ef5dc65..6dbe5c7 100644 --- a/src/routes/shared/[key]/+page.server.ts +++ b/src/routes/shared/[key]/+page.server.ts @@ -5,14 +5,33 @@ import type { Adventure } from "$lib/utils/types"; export async function load({ params }) { let key = params.key; + + // Fetch data from the database let result = await db .select() .from(sharedAdventures) .where(eq(sharedAdventures.id, key)) .execute(); - let adventure = result[0].data as Adventure; - console.log(adventure); + + // Assuming result is an array with a single object + let rawData = result[0]; + + // Parse the data field, which contains a JSON string + let adventures = JSON.parse(rawData.data as string); + + // Map the parsed adventures to the Adventure interface + let adventureArray = adventures.map((item: any) => { + return { + id: item.id, + name: item.name, + location: item.location, + created: item.created, + } as Adventure; + }); + + + // Return the array of Adventure objects return { - result: adventure, + adventureArray, }; } diff --git a/src/routes/shared/[key]/+page.svelte b/src/routes/shared/[key]/+page.svelte index 90e6a62..bb9f20d 100644 --- a/src/routes/shared/[key]/+page.svelte +++ b/src/routes/shared/[key]/+page.svelte @@ -1,7 +1,30 @@ -

{result}

+ + +

Shared Adventure List

+
+ {#each array as adventure (adventure.id)} + + {/each} +
diff --git a/tailwind.config.js b/tailwind.config.js index 389e6e9..2d48b1b 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -6,6 +6,6 @@ export default { }, plugins: [require("@tailwindcss/typography"), require("daisyui")], daisyui: { - themes: ["sunset"], + themes: ["night"], }, }; From a6c3738c4854d9324b2b0f278bb9dafc81bc7b2c Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Thu, 11 Apr 2024 22:21:09 +0000 Subject: [PATCH 03/20] Add name and date columns to sharedAdventures table and display them in shared adventure page --- migrations/0011_heavy_ben_urich.sql | 2 + migrations/meta/0011_snapshot.json | 219 ++++++++++++++++++++++++ migrations/meta/_journal.json | 7 + src/lib/db/schema.ts | 2 + src/routes/api/share/+server.ts | 8 +- src/routes/shared/[key]/+page.server.ts | 5 + src/routes/shared/[key]/+page.svelte | 1 + 7 files changed, 241 insertions(+), 3 deletions(-) create mode 100644 migrations/0011_heavy_ben_urich.sql create mode 100644 migrations/meta/0011_snapshot.json diff --git a/migrations/0011_heavy_ben_urich.sql b/migrations/0011_heavy_ben_urich.sql new file mode 100644 index 0000000..6f47f52 --- /dev/null +++ b/migrations/0011_heavy_ben_urich.sql @@ -0,0 +1,2 @@ +ALTER TABLE "sharedAdventures" ADD COLUMN "name" text NOT NULL;--> statement-breakpoint +ALTER TABLE "sharedAdventures" ADD COLUMN "date" text NOT NULL; \ No newline at end of file diff --git a/migrations/meta/0011_snapshot.json b/migrations/meta/0011_snapshot.json new file mode 100644 index 0000000..5b38d4a --- /dev/null +++ b/migrations/meta/0011_snapshot.json @@ -0,0 +1,219 @@ +{ + "id": "b318f7a7-c4e1-49f3-9bfc-7d68f118bf7d", + "prevId": "d6cd08c8-9dc8-42df-aab9-0f5800602864", + "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": {} + }, + "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": {} + } + }, + "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 3f770a8..ef98192 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -78,6 +78,13 @@ "when": 1712842196443, "tag": "0010_lean_gamma_corps", "breakpoints": true + }, + { + "idx": 11, + "version": "5", + "when": 1712873663208, + "tag": "0011_heavy_ben_urich", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index 9ed9b15..5df214e 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -16,6 +16,8 @@ export const featuredAdventures = pgTable("featuredAdventures", { export const sharedAdventures = pgTable("sharedAdventures", { id: text("id").primaryKey(), data: json("data").notNull(), + name: text("name").notNull(), + date: text("date").notNull(), }); export const userTable = pgTable("user", { diff --git a/src/routes/api/share/+server.ts b/src/routes/api/share/+server.ts index 5fdf9a3..86f3dc7 100644 --- a/src/routes/api/share/+server.ts +++ b/src/routes/api/share/+server.ts @@ -2,13 +2,15 @@ import { db } from "$lib/db/db.server"; import { sharedAdventures } from "$lib/db/schema"; import type { Adventure } from "$lib/utils/types"; -export async function POST({ request }: { request: Request }) { +export async function POST({ request, locals }) { const { key, data } = await request.json(); let adventure = data as Adventure; console.log(adventure); + let date = new Date().toISOString().split("T")[0]; + let name = locals.user ? locals.user.username : "Anonymous"; await db .insert(sharedAdventures) - .values({ id: key, data: adventure }) + .values({ id: key, data: adventure, name:name, date:date }) .execute(); return new Response(JSON.stringify({ key: key })); -} +} \ No newline at end of file diff --git a/src/routes/shared/[key]/+page.server.ts b/src/routes/shared/[key]/+page.server.ts index 6dbe5c7..92f7d08 100644 --- a/src/routes/shared/[key]/+page.server.ts +++ b/src/routes/shared/[key]/+page.server.ts @@ -29,9 +29,14 @@ export async function load({ params }) { } as Adventure; }); + let name = rawData.name; + let date = rawData.date; + // Return the array of Adventure objects return { adventureArray, + name, + date, }; } diff --git a/src/routes/shared/[key]/+page.svelte b/src/routes/shared/[key]/+page.svelte index bb9f20d..9c2e69f 100644 --- a/src/routes/shared/[key]/+page.svelte +++ b/src/routes/shared/[key]/+page.svelte @@ -15,6 +15,7 @@ {/each} -->

Shared Adventure List

+

By {data.name} on {data.date}

From a17c48252222e0b03b63fce2193ff17a2976dee6 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Thu, 11 Apr 2024 22:58:54 +0000 Subject: [PATCH 04/20] Add PostgreSQL client and SQL scripts for parks data --- Dockerfile | 2 ++ docker-compose.yml | 4 +++- {sampleData => sql}/parks.sql | 0 startup.sh | 21 +++++++++++++++++++-- 4 files changed, 24 insertions(+), 3 deletions(-) rename {sampleData => sql}/parks.sql (100%) diff --git a/Dockerfile b/Dockerfile index 97eb7d7..a9d97fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,8 @@ FROM node:18-alpine AS external-website # A small line inside the image to show who made it LABEL Developers="Sean Morley" +RUN apk update && apk add postgresql-client + # The WORKDIR instruction sets the working directory for everything that will happen next WORKDIR /app diff --git a/docker-compose.yml b/docker-compose.yml index a050d04..4a58128 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: web: - image: ghcr.io/seanmorley15/adventurelog:latest + build: . ports: - "3000:3000" environment: @@ -9,6 +9,8 @@ services: - ORIGIN=http://localhost:3000 depends_on: - db + volumes: + - ./sql:/sql db: image: postgres environment: diff --git a/sampleData/parks.sql b/sql/parks.sql similarity index 100% rename from sampleData/parks.sql rename to sql/parks.sql diff --git a/startup.sh b/startup.sh index 07e73f8..10039d0 100644 --- a/startup.sh +++ b/startup.sh @@ -9,8 +9,22 @@ wait_for_db() { echo "Database is now available." } +# Function to run SQL scripts +run_sql_scripts() { + echo "Running SQL scripts..." + + # Define the path to your SQL scripts + SQL_SCRIPTS_PATH="/sql" # Replace with the path to your SQL scripts + + # Run each SQL script in the directory using the DATABASE_URL + for sql_script in "$SQL_SCRIPTS_PATH"/*.sql; do + echo "Running script: $sql_script" + psql "$DATABASE_URL" -f "$sql_script" + done + echo "Finished running SQL scripts." +} + # Start your application here -# Example: node build/index.js # Print message echo "Starting AdventureLog" @@ -23,6 +37,9 @@ npm run generate # Run database migration npm run migrate -echo "The orgin to be set is: $ORIGIN" +# Run SQL scripts +run_sql_scripts + +echo "The origin to be set is: $ORIGIN" # Start the application ORIGIN=$ORIGIN node build From a03fc5fb4e4a9d3ab485abe22451c9236d831114 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Thu, 11 Apr 2024 23:58:09 +0000 Subject: [PATCH 05/20] Add and delete migration files --- migrations/0000_fancy_starjammers.sql | 5 - migrations/0000_panoramic_the_fury.sql | 66 ++++++ migrations/0001_nostalgic_skreet.sql | 6 - migrations/0001_smart_cargill.sql | 1 + migrations/0002_dusty_captain_midlands.sql | 1 - migrations/0002_glamorous_junta.sql | 11 + migrations/0003_clammy_goblin_queen.sql | 4 - migrations/0003_nasty_onslaught.sql | 1 + migrations/0004_short_luke_cage.sql | 2 + migrations/0004_smart_maelstrom.sql | 15 -- migrations/0005_glamorous_pixie.sql | 2 - migrations/0005_nervous_krista_starr.sql | 1 + migrations/0006_fuzzy_gamma_corps.sql | 1 + migrations/0006_melted_leech.sql | 1 - migrations/0007_nervous_scalphunter.sql | 2 - migrations/0007_youthful_shiver_man.sql | 1 + migrations/0008_romantic_maria_hill.sql | 12 - migrations/0009_spotty_madame_web.sql | 5 - migrations/0010_lean_gamma_corps.sql | 1 - migrations/0011_heavy_ben_urich.sql | 2 - migrations/meta/0000_snapshot.json | 254 ++++++++++++++++++++- migrations/meta/0001_snapshot.json | 192 +++++++++++++++- migrations/meta/0002_snapshot.json | 226 +++++++++++++++++- migrations/meta/0003_snapshot.json | 234 ++++++++++++++++++- migrations/meta/0004_snapshot.json | 176 +++++++++++++- migrations/meta/0005_snapshot.json | 164 ++++++++++++- migrations/meta/0006_snapshot.json | 164 ++++++++++++- migrations/meta/0007_snapshot.json | 110 ++++++++- migrations/meta/0008_snapshot.json | 195 ---------------- migrations/meta/0009_snapshot.json | 201 ---------------- migrations/meta/0010_snapshot.json | 207 ----------------- migrations/meta/0011_snapshot.json | 219 ------------------ migrations/meta/_journal.json | 60 ++--- sql/countries.sql | 17 ++ sql/parks.sql | 1 + src/lib/db/schema.ts | 9 + src/routes/worldtravel/+page.server.ts | 19 ++ src/routes/worldtravel/+page.svelte | 20 ++ 38 files changed, 1663 insertions(+), 945 deletions(-) delete mode 100644 migrations/0000_fancy_starjammers.sql create mode 100644 migrations/0000_panoramic_the_fury.sql delete mode 100644 migrations/0001_nostalgic_skreet.sql create mode 100644 migrations/0001_smart_cargill.sql delete mode 100644 migrations/0002_dusty_captain_midlands.sql create mode 100644 migrations/0002_glamorous_junta.sql delete mode 100644 migrations/0003_clammy_goblin_queen.sql create mode 100644 migrations/0003_nasty_onslaught.sql create mode 100644 migrations/0004_short_luke_cage.sql delete mode 100644 migrations/0004_smart_maelstrom.sql delete mode 100644 migrations/0005_glamorous_pixie.sql create mode 100644 migrations/0005_nervous_krista_starr.sql create mode 100644 migrations/0006_fuzzy_gamma_corps.sql delete mode 100644 migrations/0006_melted_leech.sql delete mode 100644 migrations/0007_nervous_scalphunter.sql create mode 100644 migrations/0007_youthful_shiver_man.sql delete mode 100644 migrations/0008_romantic_maria_hill.sql delete mode 100644 migrations/0009_spotty_madame_web.sql delete mode 100644 migrations/0010_lean_gamma_corps.sql delete mode 100644 migrations/0011_heavy_ben_urich.sql delete mode 100644 migrations/meta/0008_snapshot.json delete mode 100644 migrations/meta/0009_snapshot.json delete mode 100644 migrations/meta/0010_snapshot.json delete mode 100644 migrations/meta/0011_snapshot.json create mode 100644 sql/countries.sql create mode 100644 src/routes/worldtravel/+page.server.ts create mode 100644 src/routes/worldtravel/+page.svelte diff --git a/migrations/0000_fancy_starjammers.sql b/migrations/0000_fancy_starjammers.sql deleted file mode 100644 index 2f2d3b5..0000000 --- a/migrations/0000_fancy_starjammers.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE IF NOT EXISTS "featuredAdventures" ( - "id" serial PRIMARY KEY NOT NULL, - "name" text NOT NULL, - "location" text -); diff --git a/migrations/0000_panoramic_the_fury.sql b/migrations/0000_panoramic_the_fury.sql new file mode 100644 index 0000000..0a49b25 --- /dev/null +++ b/migrations/0000_panoramic_the_fury.sql @@ -0,0 +1,66 @@ +CREATE TABLE IF NOT EXISTS "featuredAdventures" ( + "id" serial PRIMARY KEY NOT NULL, + "name" text NOT NULL, + "location" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "session" ( + "id" text PRIMARY KEY NOT NULL, + "user_id" text NOT NULL, + "expires_at" timestamp with time zone NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "sharedAdventures" ( + "id" text PRIMARY KEY NOT NULL, + "data" json NOT NULL, + "name" text NOT NULL, + "date" text NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "user" ( + "id" text PRIMARY KEY NOT NULL, + "username" text NOT NULL, + "first_name" text NOT NULL, + "last_name" text NOT NULL, + "icon" text, + "hashed_password" varchar NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "userVisitedAdventures" ( + "adventure_id" serial PRIMARY KEY NOT NULL, + "user_id" text NOT NULL, + "adventure_name" text NOT NULL, + "location" text, + "visited_date" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "worldTravelCountries" ( + "id" serial PRIMARY KEY NOT NULL, + "name" text NOT NULL, + "country_code" text NOT NULL, + "continent" text NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "worldTravelRegions" ( + "id" serial PRIMARY KEY NOT NULL, + "name" text NOT NULL, + "country_id" text NOT NULL +); +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "userVisitedAdventures" ADD CONSTRAINT "userVisitedAdventures_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "worldTravelRegions" ADD CONSTRAINT "worldTravelRegions_country_id_worldTravelCountries_id_fk" FOREIGN KEY ("country_id") REFERENCES "worldTravelCountries"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/migrations/0001_nostalgic_skreet.sql b/migrations/0001_nostalgic_skreet.sql deleted file mode 100644 index cf21484..0000000 --- a/migrations/0001_nostalgic_skreet.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE IF NOT EXISTS "sharedAdventures" ( - "id" serial PRIMARY KEY NOT NULL, - "name" text NOT NULL, - "location" text, - "date" text -); diff --git a/migrations/0001_smart_cargill.sql b/migrations/0001_smart_cargill.sql new file mode 100644 index 0000000..4c29cad --- /dev/null +++ b/migrations/0001_smart_cargill.sql @@ -0,0 +1 @@ +DROP TABLE "worldTravelRegions"; \ No newline at end of file diff --git a/migrations/0002_dusty_captain_midlands.sql b/migrations/0002_dusty_captain_midlands.sql deleted file mode 100644 index 5945004..0000000 --- a/migrations/0002_dusty_captain_midlands.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "sharedAdventures" ALTER COLUMN "id" SET DATA TYPE text; \ No newline at end of file diff --git a/migrations/0002_glamorous_junta.sql b/migrations/0002_glamorous_junta.sql new file mode 100644 index 0000000..18653c4 --- /dev/null +++ b/migrations/0002_glamorous_junta.sql @@ -0,0 +1,11 @@ +CREATE TABLE IF NOT EXISTS "worldTravelRegions" ( + "id" serial PRIMARY KEY NOT NULL, + "name" text NOT NULL, + "country_id" text NOT NULL +); +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "worldTravelRegions" ADD CONSTRAINT "worldTravelRegions_country_id_worldTravelCountries_id_fk" FOREIGN KEY ("country_id") REFERENCES "worldTravelCountries"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/migrations/0003_clammy_goblin_queen.sql b/migrations/0003_clammy_goblin_queen.sql deleted file mode 100644 index ada8daf..0000000 --- a/migrations/0003_clammy_goblin_queen.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE "sharedAdventures" ADD COLUMN "data" json NOT NULL;--> statement-breakpoint -ALTER TABLE "sharedAdventures" DROP COLUMN IF EXISTS "name";--> statement-breakpoint -ALTER TABLE "sharedAdventures" DROP COLUMN IF EXISTS "location";--> statement-breakpoint -ALTER TABLE "sharedAdventures" DROP COLUMN IF EXISTS "date"; \ No newline at end of file diff --git a/migrations/0003_nasty_onslaught.sql b/migrations/0003_nasty_onslaught.sql new file mode 100644 index 0000000..e9faf11 --- /dev/null +++ b/migrations/0003_nasty_onslaught.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelRegions" ALTER COLUMN "country_id" SET DATA TYPE serial; \ No newline at end of file diff --git a/migrations/0004_short_luke_cage.sql b/migrations/0004_short_luke_cage.sql new file mode 100644 index 0000000..4e6e152 --- /dev/null +++ b/migrations/0004_short_luke_cage.sql @@ -0,0 +1,2 @@ +ALTER TABLE "worldTravelRegions" ALTER COLUMN "id" SET DATA TYPE text;--> statement-breakpoint +ALTER TABLE "worldTravelRegions" ALTER COLUMN "country_id" SET DATA TYPE text; \ No newline at end of file diff --git a/migrations/0004_smart_maelstrom.sql b/migrations/0004_smart_maelstrom.sql deleted file mode 100644 index 5982edc..0000000 --- a/migrations/0004_smart_maelstrom.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE IF NOT EXISTS "session" ( - "id" text PRIMARY KEY NOT NULL, - "user_id" text NOT NULL, - "expires_at" timestamp with time zone NOT NULL -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "user" ( - "id" text PRIMARY KEY NOT NULL -); ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; diff --git a/migrations/0005_glamorous_pixie.sql b/migrations/0005_glamorous_pixie.sql deleted file mode 100644 index c50335d..0000000 --- a/migrations/0005_glamorous_pixie.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "user" ADD COLUMN "username" text NOT NULL;--> statement-breakpoint -ALTER TABLE "user" ADD COLUMN "hashed_password" text NOT NULL; \ No newline at end of file diff --git a/migrations/0005_nervous_krista_starr.sql b/migrations/0005_nervous_krista_starr.sql new file mode 100644 index 0000000..1cd4bab --- /dev/null +++ b/migrations/0005_nervous_krista_starr.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelRegions" ALTER COLUMN "country_id" SET DATA TYPE integer; \ No newline at end of file diff --git a/migrations/0006_fuzzy_gamma_corps.sql b/migrations/0006_fuzzy_gamma_corps.sql new file mode 100644 index 0000000..47b3cec --- /dev/null +++ b/migrations/0006_fuzzy_gamma_corps.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelRegions" ALTER COLUMN "id" SET DATA TYPE serial; \ No newline at end of file diff --git a/migrations/0006_melted_leech.sql b/migrations/0006_melted_leech.sql deleted file mode 100644 index 202d31b..0000000 --- a/migrations/0006_melted_leech.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "user" ALTER COLUMN "hashed_password" SET DATA TYPE varchar; \ No newline at end of file diff --git a/migrations/0007_nervous_scalphunter.sql b/migrations/0007_nervous_scalphunter.sql deleted file mode 100644 index baf412d..0000000 --- a/migrations/0007_nervous_scalphunter.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "user" ADD COLUMN "first_name" text NOT NULL;--> statement-breakpoint -ALTER TABLE "user" ADD COLUMN "last_name" text NOT NULL; \ No newline at end of file diff --git a/migrations/0007_youthful_shiver_man.sql b/migrations/0007_youthful_shiver_man.sql new file mode 100644 index 0000000..4c29cad --- /dev/null +++ b/migrations/0007_youthful_shiver_man.sql @@ -0,0 +1 @@ +DROP TABLE "worldTravelRegions"; \ No newline at end of file diff --git a/migrations/0008_romantic_maria_hill.sql b/migrations/0008_romantic_maria_hill.sql deleted file mode 100644 index da68456..0000000 --- a/migrations/0008_romantic_maria_hill.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE IF NOT EXISTS "userVisitedAdventures" ( - "user_id" text NOT NULL, - "adventure_name" text NOT NULL, - "location" text, - "adventure_visited" text -); ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "userVisitedAdventures" ADD CONSTRAINT "userVisitedAdventures_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; diff --git a/migrations/0009_spotty_madame_web.sql b/migrations/0009_spotty_madame_web.sql deleted file mode 100644 index 900b8d7..0000000 --- a/migrations/0009_spotty_madame_web.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE "userVisitedAdventures" RENAME COLUMN "adventure_visited" TO "adventure_id";--> statement-breakpoint -ALTER TABLE "userVisitedAdventures" ADD PRIMARY KEY ("adventure_id");--> statement-breakpoint -ALTER TABLE "userVisitedAdventures" ALTER COLUMN "adventure_id" SET DATA TYPE serial;--> statement-breakpoint -ALTER TABLE "userVisitedAdventures" ALTER COLUMN "adventure_id" SET NOT NULL;--> statement-breakpoint -ALTER TABLE "userVisitedAdventures" ADD COLUMN "visited_date" text; \ No newline at end of file diff --git a/migrations/0010_lean_gamma_corps.sql b/migrations/0010_lean_gamma_corps.sql deleted file mode 100644 index 81eb4e1..0000000 --- a/migrations/0010_lean_gamma_corps.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "user" ADD COLUMN "icon" text; \ No newline at end of file diff --git a/migrations/0011_heavy_ben_urich.sql b/migrations/0011_heavy_ben_urich.sql deleted file mode 100644 index 6f47f52..0000000 --- a/migrations/0011_heavy_ben_urich.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "sharedAdventures" ADD COLUMN "name" text NOT NULL;--> statement-breakpoint -ALTER TABLE "sharedAdventures" ADD COLUMN "date" text NOT NULL; \ No newline at end of file diff --git a/migrations/meta/0000_snapshot.json b/migrations/meta/0000_snapshot.json index 5700d27..ecf5508 100644 --- a/migrations/meta/0000_snapshot.json +++ b/migrations/meta/0000_snapshot.json @@ -1,5 +1,5 @@ { - "id": "1639b320-88dd-4af5-ae34-092ab26b4b85", + "id": "9341b0b9-3e38-4043-bc4e-5655d8f0a953", "prevId": "00000000-0000-0000-0000-000000000000", "version": "5", "dialect": "pg", @@ -31,6 +31,258 @@ "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {} + }, + "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": {} + }, + "worldTravelRegions": { + "name": "worldTravelRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_id": { + "name": "country_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelRegions_country_id_worldTravelCountries_id_fk": { + "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", + "tableFrom": "worldTravelRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0001_snapshot.json b/migrations/meta/0001_snapshot.json index bbdf8d5..862a31e 100644 --- a/migrations/meta/0001_snapshot.json +++ b/migrations/meta/0001_snapshot.json @@ -1,6 +1,6 @@ { - "id": "183ebfda-8d83-4256-8715-169d36867deb", - "prevId": "1639b320-88dd-4af5-ae34-092ab26b4b85", + "id": "125fff71-fcac-407b-b811-cdc6cf7931b0", + "prevId": "9341b0b9-3e38-4043-bc4e-5655d8f0a953", "version": "5", "dialect": "pg", "tables": { @@ -32,9 +32,185 @@ "compositePrimaryKeys": {}, "uniqueConstraints": {} }, + "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", @@ -48,17 +224,17 @@ "primaryKey": false, "notNull": true }, - "location": { - "name": "location", + "country_code": { + "name": "country_code", "type": "text", "primaryKey": false, - "notNull": false + "notNull": true }, - "date": { - "name": "date", + "continent": { + "name": "continent", "type": "text", "primaryKey": false, - "notNull": false + "notNull": true } }, "indexes": {}, diff --git a/migrations/meta/0002_snapshot.json b/migrations/meta/0002_snapshot.json index 7be23f6..054374a 100644 --- a/migrations/meta/0002_snapshot.json +++ b/migrations/meta/0002_snapshot.json @@ -1,6 +1,6 @@ { - "id": "808d6d31-5ef6-4b22-97f0-cfc73193eb5e", - "prevId": "183ebfda-8d83-4256-8715-169d36867deb", + "id": "88f059b3-b83f-4031-b2f1-89401d74ad1b", + "prevId": "125fff71-fcac-407b-b811-cdc6cf7931b0", "version": "5", "dialect": "pg", "tables": { @@ -32,6 +32,48 @@ "compositePrimaryKeys": {}, "uniqueConstraints": {} }, + "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": "", @@ -42,29 +84,205 @@ "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 }, - "date": { - "name": "date", + "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": {} + }, + "worldTravelRegions": { + "name": "worldTravelRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_id": { + "name": "country_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelRegions_country_id_worldTravelCountries_id_fk": { + "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", + "tableFrom": "worldTravelRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0003_snapshot.json b/migrations/meta/0003_snapshot.json index f8fd8c1..0b80ab5 100644 --- a/migrations/meta/0003_snapshot.json +++ b/migrations/meta/0003_snapshot.json @@ -1,6 +1,6 @@ { - "id": "45d98527-f0a9-44fc-9658-d3c461afed95", - "prevId": "808d6d31-5ef6-4b22-97f0-cfc73193eb5e", + "id": "e6295a91-815f-4f5e-8e1c-f83901c9b8d1", + "prevId": "88f059b3-b83f-4031-b2f1-89401d74ad1b", "version": "5", "dialect": "pg", "tables": { @@ -32,6 +32,48 @@ "compositePrimaryKeys": {}, "uniqueConstraints": {} }, + "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": "", @@ -47,12 +89,200 @@ "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": {} + }, + "worldTravelRegions": { + "name": "worldTravelRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_id": { + "name": "country_id", + "type": "serial", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelRegions_country_id_worldTravelCountries_id_fk": { + "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", + "tableFrom": "worldTravelRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0004_snapshot.json b/migrations/meta/0004_snapshot.json index 9d59b97..a895a77 100644 --- a/migrations/meta/0004_snapshot.json +++ b/migrations/meta/0004_snapshot.json @@ -1,6 +1,6 @@ { - "id": "ccf7c336-c61f-452f-822b-b3b039bb20f9", - "prevId": "45d98527-f0a9-44fc-9658-d3c461afed95", + "id": "ca4d65ff-ab48-476d-8494-27a21ac0fcf4", + "prevId": "e6295a91-815f-4f5e-8e1c-f83901c9b8d1", "version": "5", "dialect": "pg", "tables": { @@ -89,6 +89,18 @@ "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": {}, @@ -105,12 +117,172 @@ "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": {} + }, + "worldTravelRegions": { + "name": "worldTravelRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_id": { + "name": "country_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelRegions_country_id_worldTravelCountries_id_fk": { + "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", + "tableFrom": "worldTravelRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0005_snapshot.json b/migrations/meta/0005_snapshot.json index 116f836..b301016 100644 --- a/migrations/meta/0005_snapshot.json +++ b/migrations/meta/0005_snapshot.json @@ -1,6 +1,6 @@ { - "id": "e91dda33-e04e-4e99-a297-21a34aa35493", - "prevId": "ccf7c336-c61f-452f-822b-b3b039bb20f9", + "id": "f19bd92c-115d-4f2e-a3be-31ece1ba07b0", + "prevId": "ca4d65ff-ab48-476d-8494-27a21ac0fcf4", "version": "5", "dialect": "pg", "tables": { @@ -89,6 +89,18 @@ "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": {}, @@ -112,8 +124,114 @@ "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 @@ -123,6 +241,48 @@ "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {} + }, + "worldTravelRegions": { + "name": "worldTravelRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_id": { + "name": "country_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelRegions_country_id_worldTravelCountries_id_fk": { + "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", + "tableFrom": "worldTravelRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0006_snapshot.json b/migrations/meta/0006_snapshot.json index 2b36a76..447088a 100644 --- a/migrations/meta/0006_snapshot.json +++ b/migrations/meta/0006_snapshot.json @@ -1,6 +1,6 @@ { - "id": "b0849b3e-02e1-42e1-b07c-6fa613c98e82", - "prevId": "e91dda33-e04e-4e99-a297-21a34aa35493", + "id": "1cfee0e3-3270-431c-9045-4938e0d02935", + "prevId": "f19bd92c-115d-4f2e-a3be-31ece1ba07b0", "version": "5", "dialect": "pg", "tables": { @@ -89,6 +89,18 @@ "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": {}, @@ -112,6 +124,24 @@ "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", @@ -123,6 +153,136 @@ "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": {} + }, + "worldTravelRegions": { + "name": "worldTravelRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_id": { + "name": "country_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelRegions_country_id_worldTravelCountries_id_fk": { + "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", + "tableFrom": "worldTravelRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0007_snapshot.json b/migrations/meta/0007_snapshot.json index e436475..4c284d4 100644 --- a/migrations/meta/0007_snapshot.json +++ b/migrations/meta/0007_snapshot.json @@ -1,6 +1,6 @@ { - "id": "2039600b-1f5f-4f37-84dd-bb40636855e7", - "prevId": "b0849b3e-02e1-42e1-b07c-6fa613c98e82", + "id": "d395e6d3-0873-4815-8875-f1c2ce0c3571", + "prevId": "1cfee0e3-3270-431c-9045-4938e0d02935", "version": "5", "dialect": "pg", "tables": { @@ -89,6 +89,18 @@ "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": {}, @@ -124,6 +136,12 @@ "primaryKey": false, "notNull": true }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, "hashed_password": { "name": "hashed_password", "type": "varchar", @@ -135,6 +153,94 @@ "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": {} } }, "enums": {}, diff --git a/migrations/meta/0008_snapshot.json b/migrations/meta/0008_snapshot.json deleted file mode 100644 index 1580c9e..0000000 --- a/migrations/meta/0008_snapshot.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "id": "ec5af5e4-8522-4383-af47-412fb43c7cc3", - "prevId": "2039600b-1f5f-4f37-84dd-bb40636855e7", - "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": {} - }, - "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 - } - }, - "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 - }, - "hashed_password": { - "name": "hashed_password", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "userVisitedAdventures": { - "name": "userVisitedAdventures", - "schema": "", - "columns": { - "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 - }, - "adventure_visited": { - "name": "adventure_visited", - "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": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0009_snapshot.json b/migrations/meta/0009_snapshot.json deleted file mode 100644 index 46e2615..0000000 --- a/migrations/meta/0009_snapshot.json +++ /dev/null @@ -1,201 +0,0 @@ -{ - "id": "1d83805d-6ee2-4dae-87a6-5af6f2d5add3", - "prevId": "ec5af5e4-8522-4383-af47-412fb43c7cc3", - "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": {} - }, - "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 - } - }, - "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 - }, - "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": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0010_snapshot.json b/migrations/meta/0010_snapshot.json deleted file mode 100644 index a5a5fdd..0000000 --- a/migrations/meta/0010_snapshot.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "id": "d6cd08c8-9dc8-42df-aab9-0f5800602864", - "prevId": "1d83805d-6ee2-4dae-87a6-5af6f2d5add3", - "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": {} - }, - "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 - } - }, - "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": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0011_snapshot.json b/migrations/meta/0011_snapshot.json deleted file mode 100644 index 5b38d4a..0000000 --- a/migrations/meta/0011_snapshot.json +++ /dev/null @@ -1,219 +0,0 @@ -{ - "id": "b318f7a7-c4e1-49f3-9bfc-7d68f118bf7d", - "prevId": "d6cd08c8-9dc8-42df-aab9-0f5800602864", - "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": {} - }, - "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": {} - } - }, - "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 ef98192..06225fe 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -5,85 +5,57 @@ { "idx": 0, "version": "5", - "when": 1712061709595, - "tag": "0000_fancy_starjammers", + "when": 1712879281600, + "tag": "0000_panoramic_the_fury", "breakpoints": true }, { "idx": 1, "version": "5", - "when": 1712083579596, - "tag": "0001_nostalgic_skreet", + "when": 1712879301598, + "tag": "0001_smart_cargill", "breakpoints": true }, { "idx": 2, "version": "5", - "when": 1712083756923, - "tag": "0002_dusty_captain_midlands", + "when": 1712879457439, + "tag": "0002_glamorous_junta", "breakpoints": true }, { "idx": 3, "version": "5", - "when": 1712083977580, - "tag": "0003_clammy_goblin_queen", + "when": 1712879488661, + "tag": "0003_nasty_onslaught", "breakpoints": true }, { "idx": 4, "version": "5", - "when": 1712103855532, - "tag": "0004_smart_maelstrom", + "when": 1712879540659, + "tag": "0004_short_luke_cage", "breakpoints": true }, { "idx": 5, "version": "5", - "when": 1712104331399, - "tag": "0005_glamorous_pixie", + "when": 1712879605930, + "tag": "0005_nervous_krista_starr", "breakpoints": true }, { "idx": 6, "version": "5", - "when": 1712105206127, - "tag": "0006_melted_leech", + "when": 1712879813045, + "tag": "0006_fuzzy_gamma_corps", "breakpoints": true }, { "idx": 7, "version": "5", - "when": 1712167204757, - "tag": "0007_nervous_scalphunter", - "breakpoints": true - }, - { - "idx": 8, - "version": "5", - "when": 1712186591227, - "tag": "0008_romantic_maria_hill", - "breakpoints": true - }, - { - "idx": 9, - "version": "5", - "when": 1712407140727, - "tag": "0009_spotty_madame_web", - "breakpoints": true - }, - { - "idx": 10, - "version": "5", - "when": 1712842196443, - "tag": "0010_lean_gamma_corps", - "breakpoints": true - }, - { - "idx": 11, - "version": "5", - "when": 1712873663208, - "tag": "0011_heavy_ben_urich", + "when": 1712879875868, + "tag": "0007_youthful_shiver_man", "breakpoints": true } ] diff --git a/sql/countries.sql b/sql/countries.sql new file mode 100644 index 0000000..adfc955 --- /dev/null +++ b/sql/countries.sql @@ -0,0 +1,17 @@ +INSERT INTO "worldTravelCountries" (name, country_code, continent) +VALUES + ('United States', 'us', 'North America'), + ('Canada', 'ca', 'North America'), + ('Mexico', 'mx', 'North America'), + ('Brazil', 'br', 'South America'), + ('Argentina', 'ar', 'South America'), + ('United Kingdom', 'gb', 'Europe'), + ('Germany', 'de', 'Europe'), + ('France', 'fr', 'Europe'), + ('Japan', 'jp', 'Asia'), + ('China', 'cn', 'Asia'), + ('India', 'in', 'Asia'), + ('Australia', 'au', 'Oceania'), + ('New Zealand', 'nz', 'Oceania'), + ('South Africa', 'za', 'Africa'), + ('Egypt', 'eg', 'Africa'); diff --git a/sql/parks.sql b/sql/parks.sql index 207813c..701017d 100644 --- a/sql/parks.sql +++ b/sql/parks.sql @@ -79,3 +79,4 @@ INSERT INTO "featuredAdventures" (id, name, location) VALUES (97, 'Acadia National Park', 'Maine, USA'), (98, 'Sequoia National Park', 'California, USA'), (99, 'Joshua Tree National Park', 'California, USA'); +ON CONFLICT (id) DO NOTHING; \ No newline at end of file diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index 5df214e..acd2e55 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -5,6 +5,8 @@ import { json, serial, varchar, + foreignKey, + integer, } from "drizzle-orm/pg-core"; export const featuredAdventures = pgTable("featuredAdventures", { @@ -51,3 +53,10 @@ export const userVisitedAdventures = pgTable("userVisitedAdventures", { location: text("location"), visitedDate: text("visited_date"), }); + +export const worldTravelCountries = pgTable("worldTravelCountries", { + id: serial("id").primaryKey(), + name: text("name").notNull(), + country_code: text("country_code").notNull(), + continent: text("continent").notNull(), +}); diff --git a/src/routes/worldtravel/+page.server.ts b/src/routes/worldtravel/+page.server.ts new file mode 100644 index 0000000..dfe39b9 --- /dev/null +++ b/src/routes/worldtravel/+page.server.ts @@ -0,0 +1,19 @@ +import { redirect } from "@sveltejs/kit"; +import type { PageServerLoad } from "./$types"; +import type { Adventure } from "$lib/utils/types"; +import { db } from "$lib/db/db.server"; +import { worldTravelCountries } from "$lib/db/schema"; + +export const load: PageServerLoad = async (event) => { + if (!event.locals.user) { + return redirect(302, "/login"); + } + let response = await db + .select() + .from(worldTravelCountries) + + // let array = result.adventures as Adventure[]; + return { + response, + }; +}; diff --git a/src/routes/worldtravel/+page.svelte b/src/routes/worldtravel/+page.svelte new file mode 100644 index 0000000..8bf0b29 --- /dev/null +++ b/src/routes/worldtravel/+page.svelte @@ -0,0 +1,20 @@ + + +

Country List

+ +{#each data.response as item} + + +{/each} From d1902225733d1f00977250090c5a236f33e32865 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 12 Apr 2024 00:03:14 +0000 Subject: [PATCH 06/20] Add unique constraint to worldTravelCountries.country_code and create worldTravelCountryRegions table --- migrations/0008_safe_mordo.sql | 1 + migrations/0009_zippy_domino.sql | 11 ++ migrations/meta/0008_snapshot.json | 261 +++++++++++++++++++++++++ migrations/meta/0009_snapshot.json | 303 +++++++++++++++++++++++++++++ migrations/meta/_journal.json | 14 ++ src/lib/db/schema.ts | 10 +- 6 files changed, 599 insertions(+), 1 deletion(-) create mode 100644 migrations/0008_safe_mordo.sql create mode 100644 migrations/0009_zippy_domino.sql create mode 100644 migrations/meta/0008_snapshot.json create mode 100644 migrations/meta/0009_snapshot.json diff --git a/migrations/0008_safe_mordo.sql b/migrations/0008_safe_mordo.sql new file mode 100644 index 0000000..af48707 --- /dev/null +++ b/migrations/0008_safe_mordo.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelCountries" ADD CONSTRAINT "worldTravelCountries_country_code_unique" UNIQUE("country_code"); \ No newline at end of file diff --git a/migrations/0009_zippy_domino.sql b/migrations/0009_zippy_domino.sql new file mode 100644 index 0000000..c62f6f2 --- /dev/null +++ b/migrations/0009_zippy_domino.sql @@ -0,0 +1,11 @@ +CREATE TABLE IF NOT EXISTS "worldTravelCountryRegions" ( + "id" serial PRIMARY KEY NOT NULL, + "name" text NOT NULL, + "country_code" text NOT NULL +); +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "worldTravelCountryRegions" ADD CONSTRAINT "worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk" FOREIGN KEY ("country_code") REFERENCES "worldTravelCountries"("country_code") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/migrations/meta/0008_snapshot.json b/migrations/meta/0008_snapshot.json new file mode 100644 index 0000000..3a784ef --- /dev/null +++ b/migrations/meta/0008_snapshot.json @@ -0,0 +1,261 @@ +{ + "id": "8b58d463-f4b8-4e19-bbf5-338c16470029", + "prevId": "d395e6d3-0873-4815-8875-f1c2ce0c3571", + "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": {} + }, + "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" + ] + } + } + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/migrations/meta/0009_snapshot.json b/migrations/meta/0009_snapshot.json new file mode 100644 index 0000000..8fb5571 --- /dev/null +++ b/migrations/meta/0009_snapshot.json @@ -0,0 +1,303 @@ +{ + "id": "309515d8-823e-493d-96c2-aef7ff79a953", + "prevId": "8b58d463-f4b8-4e19-bbf5-338c16470029", + "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": {} + }, + "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": "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 + } + }, + "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": {} + } + }, + "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 06225fe..fbc2529 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -57,6 +57,20 @@ "when": 1712879875868, "tag": "0007_youthful_shiver_man", "breakpoints": true + }, + { + "idx": 8, + "version": "5", + "when": 1712880065046, + "tag": "0008_safe_mordo", + "breakpoints": true + }, + { + "idx": 9, + "version": "5", + "when": 1712880141763, + "tag": "0009_zippy_domino", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index acd2e55..0a247b2 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -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), +}); \ No newline at end of file From 8a8a118309e032f3b83688feea9320c7841f3aa6 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 12 Apr 2024 00:12:55 +0000 Subject: [PATCH 07/20] Add navigation to World Travel page and create server load function for country regions --- src/lib/components/Navbar.svelte | 11 +++++++++-- .../worldtravel/[countrycode]/+page.server.ts | 16 ++++++++++++++++ .../worldtravel/[countrycode]/+page.svelte | 7 +++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 src/routes/worldtravel/[countrycode]/+page.server.ts create mode 100644 src/routes/worldtravel/[countrycode]/+page.svelte diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index 54960ee..e356ac5 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -20,9 +20,12 @@ async function toToLogin() { goto("/login"); } - async function toToSignup() { + async function goToSignup() { goto("/signup"); } + async function goToWorldTravel() { + goto("/worldtravel"); + } let count = 0; @@ -67,6 +70,10 @@ + {/if} {#if !user} - + {/if} {#if user} diff --git a/src/routes/worldtravel/[countrycode]/+page.server.ts b/src/routes/worldtravel/[countrycode]/+page.server.ts new file mode 100644 index 0000000..8b8458c --- /dev/null +++ b/src/routes/worldtravel/[countrycode]/+page.server.ts @@ -0,0 +1,16 @@ +// server laod function +import { db } from '$lib/db/db.server.js'; +import { worldTravelCountryRegions } from '$lib/db/schema.js'; +import { eq } from 'drizzle-orm'; + +export async function load({ params }) { + const { countrycode } = params; + let data = await db + .select() + .from(worldTravelCountryRegions) + .where(eq(worldTravelCountryRegions.country_code, countrycode)) + console.log(data) + return { + regions : data, + }; +} \ No newline at end of file diff --git a/src/routes/worldtravel/[countrycode]/+page.svelte b/src/routes/worldtravel/[countrycode]/+page.svelte new file mode 100644 index 0000000..86c8d74 --- /dev/null +++ b/src/routes/worldtravel/[countrycode]/+page.svelte @@ -0,0 +1,7 @@ + + +{#each data.regions as region} +

{region.name}

+{/each} From a17234ab6b64d47b87cd9fc4abb49080548936df Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 12 Apr 2024 01:27:13 +0000 Subject: [PATCH 08/20] Add unique constraints to featuredAdventures and worldTravelCountryRegions tables, and insert data for Canada, Germany, and the US regions. --- migrations/0010_closed_nicolaos.sql | 1 + migrations/0011_legal_red_hulk.sql | 1 + migrations/meta/0010_snapshot.json | 311 +++++++++++++++++++++++++++ migrations/meta/0011_snapshot.json | 319 ++++++++++++++++++++++++++++ migrations/meta/_journal.json | 14 ++ sql/ca.sql | 17 ++ sql/countries.sql | 3 +- sql/de.sql | 20 ++ sql/parks.sql | 97 ++------- sql/us.sql | 54 +++++ src/lib/db/schema.ts | 4 +- 11 files changed, 756 insertions(+), 85 deletions(-) create mode 100644 migrations/0010_closed_nicolaos.sql create mode 100644 migrations/0011_legal_red_hulk.sql create mode 100644 migrations/meta/0010_snapshot.json create mode 100644 migrations/meta/0011_snapshot.json create mode 100644 sql/ca.sql create mode 100644 sql/de.sql create mode 100644 sql/us.sql diff --git a/migrations/0010_closed_nicolaos.sql b/migrations/0010_closed_nicolaos.sql new file mode 100644 index 0000000..3f0f4f0 --- /dev/null +++ b/migrations/0010_closed_nicolaos.sql @@ -0,0 +1 @@ +ALTER TABLE "featuredAdventures" ADD CONSTRAINT "featuredAdventures_name_unique" UNIQUE("name"); \ No newline at end of file diff --git a/migrations/0011_legal_red_hulk.sql b/migrations/0011_legal_red_hulk.sql new file mode 100644 index 0000000..7f6cdfa --- /dev/null +++ b/migrations/0011_legal_red_hulk.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelCountryRegions" ADD CONSTRAINT "worldTravelCountryRegions_name_unique" UNIQUE("name"); \ No newline at end of file diff --git a/migrations/meta/0010_snapshot.json b/migrations/meta/0010_snapshot.json new file mode 100644 index 0000000..8824345 --- /dev/null +++ b/migrations/meta/0010_snapshot.json @@ -0,0 +1,311 @@ +{ + "id": "988ebc41-0384-43ed-a4dc-acaf5f14f88b", + "prevId": "309515d8-823e-493d-96c2-aef7ff79a953", + "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": "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 + } + }, + "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": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/migrations/meta/0011_snapshot.json b/migrations/meta/0011_snapshot.json new file mode 100644 index 0000000..762a976 --- /dev/null +++ b/migrations/meta/0011_snapshot.json @@ -0,0 +1,319 @@ +{ + "id": "341b817a-4a1f-43ea-9e49-34769fca6da8", + "prevId": "988ebc41-0384-43ed-a4dc-acaf5f14f88b", + "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": "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 + } + }, + "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/_journal.json b/migrations/meta/_journal.json index fbc2529..ef36d66 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -71,6 +71,20 @@ "when": 1712880141763, "tag": "0009_zippy_domino", "breakpoints": true + }, + { + "idx": 10, + "version": "5", + "when": 1712884724835, + "tag": "0010_closed_nicolaos", + "breakpoints": true + }, + { + "idx": 11, + "version": "5", + "when": 1712885083355, + "tag": "0011_legal_red_hulk", + "breakpoints": true } ] } \ No newline at end of file diff --git a/sql/ca.sql b/sql/ca.sql new file mode 100644 index 0000000..d814a98 --- /dev/null +++ b/sql/ca.sql @@ -0,0 +1,17 @@ +INSERT INTO "worldTravelCountryRegions" (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; diff --git a/sql/countries.sql b/sql/countries.sql index adfc955..9789561 100644 --- a/sql/countries.sql +++ b/sql/countries.sql @@ -14,4 +14,5 @@ VALUES ('Australia', 'au', 'Oceania'), ('New Zealand', 'nz', 'Oceania'), ('South Africa', 'za', 'Africa'), - ('Egypt', 'eg', 'Africa'); + ('Egypt', 'eg', 'Africa'), +ON CONFLICT (country_code) DO NOTHING; \ No newline at end of file diff --git a/sql/de.sql b/sql/de.sql new file mode 100644 index 0000000..f694365 --- /dev/null +++ b/sql/de.sql @@ -0,0 +1,20 @@ +INSERT INTO "worldTravelCountryRegions" (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'); + +ON CONFLICT (name) DO NOTHING; diff --git a/sql/parks.sql b/sql/parks.sql index 701017d..b8697f4 100644 --- a/sql/parks.sql +++ b/sql/parks.sql @@ -1,82 +1,15 @@ -INSERT INTO "featuredAdventures" (id, name, location) VALUES - (20, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'), - (21, 'Yosemite National Park', 'California, USA'), - (22, 'Banff National Park', 'Alberta, Canada'), - (23, 'Kruger National Park', 'Limpopo, South Africa'), - (24, 'Grand Canyon National Park', 'Arizona, USA'), - (25, 'Great Smoky Mountains National Park', 'North Carolina, Tennessee, USA'), - (26, 'Zion National Park', 'Utah, USA'), - (27, 'Glacier National Park', 'Montana, USA'), - (28, 'Rocky Mountain National Park', 'Colorado, USA'), - (29, 'Everglades National Park', 'Florida, USA'), - (30, 'Arches National Park', 'Utah, USA'), - (31, 'Acadia National Park', 'Maine, USA'), - (32, 'Sequoia National Park', 'California, USA'), - (33, 'Joshua Tree National Park', 'California, USA'), - (34, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'), - (35, 'Bryce Canyon National Park', 'Utah, USA'), - (36, 'Grand Teton National Park', 'Wyoming, USA'), - (37, 'Denali National Park', 'Alaska, USA'), - (38, 'Olympic National Park', 'Washington, USA'), - (39, 'Canyonlands National Park', 'Utah, USA'), - (40, 'Death Valley National Park', 'California, Nevada, USA'), - (41, 'Redwood National and State Parks', 'California, USA'), - (42, 'Waterton Lakes National Park', 'Alberta, Canada'), - (43, 'Mesa Verde National Park', 'Colorado, USA'), - (44, 'Petrified Forest National Park', 'Arizona, USA'), - (45, 'Capitol Reef National Park', 'Utah, USA'), - (46, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'), - (47, 'Yosemite National Park', 'California, USA'), - (48, 'Banff National Park', 'Alberta, Canada'), - (49, 'Kruger National Park', 'Limpopo, South Africa'), - (50, 'Grand Canyon National Park', 'Arizona, USA'), - (51, 'Great Smoky Mountains National Park', 'North Carolina, Tennessee, USA'), - (52, 'Zion National Park', 'Utah, USA'), - (53, 'Glacier National Park', 'Montana, USA'), - (54, 'Rocky Mountain National Park', 'Colorado, USA'), - (55, 'Everglades National Park', 'Florida, USA'), - (56, 'Arches National Park', 'Utah, USA'), - (57, 'Acadia National Park', 'Maine, USA'), - (58, 'Sequoia National Park', 'California, USA'), - (59, 'Joshua Tree National Park', 'California, USA'), - (60, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'), - (61, 'Bryce Canyon National Park', 'Utah, USA'), - (62, 'Grand Teton National Park', 'Wyoming, USA'), - (63, 'Denali National Park', 'Alaska, USA'), - (64, 'Olympic National Park', 'Washington, USA'), - (65, 'Canyonlands National Park', 'Utah, USA'), - (66, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'), - (67, 'Yosemite National Park', 'California, USA'), - (68, 'Banff National Park', 'Alberta, Canada'), - (69, 'Kruger National Park', 'Limpopo, South Africa'), - (70, 'Grand Canyon National Park', 'Arizona, USA'), - (71, 'Great Smoky Mountains National Park', 'North Carolina, Tennessee, USA'), - (72, 'Zion National Park', 'Utah, USA'), - (73, 'Glacier National Park', 'Montana, USA'), - (74, 'Rocky Mountain National Park', 'Colorado, USA'), - (75, 'Everglades National Park', 'Florida, USA'), - (76, 'Arches National Park', 'Utah, USA'), - (77, 'Acadia National Park', 'Maine, USA'), - (78, 'Sequoia National Park', 'California, USA'), - (79, 'Joshua Tree National Park', 'California, USA'), - (80, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'), - (81, 'Bryce Canyon National Park', 'Utah, USA'), - (82, 'Grand Teton National Park', 'Wyoming, USA'), - (83, 'Denali National Park', 'Alaska, USA'), - (84, 'Olympic National Park', 'Washington, USA'), - (85, 'Canyonlands National Park', 'Utah, USA'), - (86, 'Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'), - (87, 'Yosemite National Park', 'California, USA'), - (88, 'Banff National Park', 'Alberta, Canada'), - (89, 'Kruger National Park', 'Limpopo, South Africa'), - (90, 'Grand Canyon National Park', 'Arizona, USA'), - (91, 'Great Smoky Mountains National Park', 'North Carolina, Tennessee, USA'), - (92, 'Zion National Park', 'Utah, USA'), - (93, 'Glacier National Park', 'Montana, USA'), - (94, 'Rocky Mountain National Park', 'Colorado, USA'), - (95, 'Everglades National Park', 'Florida, USA'), - (96, 'Arches National Park', 'Utah, USA'), - (97, 'Acadia National Park', 'Maine, USA'), - (98, 'Sequoia National Park', 'California, USA'), - (99, 'Joshua Tree National Park', 'California, USA'); -ON CONFLICT (id) DO NOTHING; \ No newline at end of file +INSERT INTO "featuredAdventures" (name, location) VALUES + ('Yellowstone National Park', 'Wyoming, Montana, Idaho, USA'), + ('Yosemite National Park', 'California, USA'), + ('Banff National Park', 'Alberta, Canada'), + ('Kruger National Park', 'Limpopo, South Africa'), + ('Grand Canyon National Park', 'Arizona, USA'), + ('Great Smoky Mountains National Park', 'North Carolina, Tennessee, USA'), + ('Zion National Park', 'Utah, USA'), + ('Glacier National Park', 'Montana, USA'), + ('Rocky Mountain National Park', 'Colorado, USA'), + ('Everglades National Park', 'Florida, USA'), + ('Arches National Park', 'Utah, USA'), + ('Acadia National Park', 'Maine, USA'), + ('Sequoia National Park', 'California, USA') +ON CONFLICT (name) DO NOTHING; \ No newline at end of file diff --git a/sql/us.sql b/sql/us.sql new file mode 100644 index 0000000..5ddd9cd --- /dev/null +++ b/sql/us.sql @@ -0,0 +1,54 @@ +INSERT INTO "worldTravelCountryRegions" (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; diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index 0a247b2..3ecc8bc 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -11,7 +11,7 @@ import { export const featuredAdventures = pgTable("featuredAdventures", { id: serial("id").primaryKey(), - name: text("name").notNull(), + name: text("name").notNull().unique(), location: text("location"), }); @@ -63,7 +63,7 @@ export const worldTravelCountries = pgTable("worldTravelCountries", { export const worldTravelCountryRegions = pgTable("worldTravelCountryRegions", { id: serial("id").primaryKey(), - name: text("name").notNull(), + name: text("name").notNull().unique(), country_code: text("country_code") .notNull() .references(() => worldTravelCountries.country_code), From d9116b2a15605bb666baffb5e63cfef8ae6ecf00 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 12 Apr 2024 01:49:57 +0000 Subject: [PATCH 09/20] Add unique constraints and insert data for Canada and Germany --- migrations/0012_slow_miracleman.sql | 2 + migrations/0013_high_unicorn.sql | 2 + migrations/meta/0012_snapshot.json | 319 +++++++++++++++++++++++ migrations/meta/0013_snapshot.json | 319 +++++++++++++++++++++++ migrations/meta/_journal.json | 14 + sql/{countries.sql => 001_countries.sql} | 2 +- sql/{us.sql => 002_us.sql} | 2 +- sql/{ca.sql => 003_ca.sql} | 2 +- sql/{de.sql => 004_de.sql} | 2 +- 9 files changed, 660 insertions(+), 4 deletions(-) create mode 100644 migrations/0012_slow_miracleman.sql create mode 100644 migrations/0013_high_unicorn.sql create mode 100644 migrations/meta/0012_snapshot.json create mode 100644 migrations/meta/0013_snapshot.json rename sql/{countries.sql => 001_countries.sql} (95%) rename sql/{us.sql => 002_us.sql} (98%) rename sql/{ca.sql => 003_ca.sql} (95%) rename sql/{de.sql => 004_de.sql} (95%) diff --git a/migrations/0012_slow_miracleman.sql b/migrations/0012_slow_miracleman.sql new file mode 100644 index 0000000..40df603 --- /dev/null +++ b/migrations/0012_slow_miracleman.sql @@ -0,0 +1,2 @@ +ALTER TABLE "worldTravelCountries" DROP CONSTRAINT "worldTravelCountries_country_code_unique";--> statement-breakpoint +ALTER TABLE "worldTravelCountries" ADD CONSTRAINT "worldTravelCountries_name_unique" UNIQUE("name"); \ No newline at end of file diff --git a/migrations/0013_high_unicorn.sql b/migrations/0013_high_unicorn.sql new file mode 100644 index 0000000..f9a2cd5 --- /dev/null +++ b/migrations/0013_high_unicorn.sql @@ -0,0 +1,2 @@ +ALTER TABLE "worldTravelCountries" DROP CONSTRAINT "worldTravelCountries_name_unique";--> statement-breakpoint +ALTER TABLE "worldTravelCountries" ADD CONSTRAINT "worldTravelCountries_country_code_unique" UNIQUE("country_code"); \ No newline at end of file diff --git a/migrations/meta/0012_snapshot.json b/migrations/meta/0012_snapshot.json new file mode 100644 index 0000000..e214bd7 --- /dev/null +++ b/migrations/meta/0012_snapshot.json @@ -0,0 +1,319 @@ +{ + "id": "3ea6cd28-ab73-49f1-be48-fdacff1559e2", + "prevId": "341b817a-4a1f-43ea-9e49-34769fca6da8", + "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_name_unique": { + "name": "worldTravelCountries_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + } + }, + "worldTravelCountryRegions": { + "name": "worldTravelCountryRegions", + "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 + } + }, + "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/0013_snapshot.json b/migrations/meta/0013_snapshot.json new file mode 100644 index 0000000..fc97e05 --- /dev/null +++ b/migrations/meta/0013_snapshot.json @@ -0,0 +1,319 @@ +{ + "id": "09cc6e72-191b-4579-ad62-e24dbc03bacf", + "prevId": "3ea6cd28-ab73-49f1-be48-fdacff1559e2", + "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": "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 + } + }, + "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/_journal.json b/migrations/meta/_journal.json index ef36d66..4a13db2 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -85,6 +85,20 @@ "when": 1712885083355, "tag": "0011_legal_red_hulk", "breakpoints": true + }, + { + "idx": 12, + "version": "5", + "when": 1712886238567, + "tag": "0012_slow_miracleman", + "breakpoints": true + }, + { + "idx": 13, + "version": "5", + "when": 1712886259872, + "tag": "0013_high_unicorn", + "breakpoints": true } ] } \ No newline at end of file diff --git a/sql/countries.sql b/sql/001_countries.sql similarity index 95% rename from sql/countries.sql rename to sql/001_countries.sql index 9789561..0608443 100644 --- a/sql/countries.sql +++ b/sql/001_countries.sql @@ -14,5 +14,5 @@ VALUES ('Australia', 'au', 'Oceania'), ('New Zealand', 'nz', 'Oceania'), ('South Africa', 'za', 'Africa'), - ('Egypt', 'eg', 'Africa'), + ('Egypt', 'eg', 'Africa') ON CONFLICT (country_code) DO NOTHING; \ No newline at end of file diff --git a/sql/us.sql b/sql/002_us.sql similarity index 98% rename from sql/us.sql rename to sql/002_us.sql index 5ddd9cd..4b6f706 100644 --- a/sql/us.sql +++ b/sql/002_us.sql @@ -49,6 +49,6 @@ VALUES ('Washington', 'us'), ('West Virginia', 'us'), ('Wisconsin', 'us'), - ('Wyoming', 'us'); + ('Wyoming', 'us') ON CONFLICT (name) DO NOTHING; diff --git a/sql/ca.sql b/sql/003_ca.sql similarity index 95% rename from sql/ca.sql rename to sql/003_ca.sql index d814a98..7fc2869 100644 --- a/sql/ca.sql +++ b/sql/003_ca.sql @@ -12,6 +12,6 @@ VALUES ('Saskatchewan', 'ca'), ('Northwest Territories', 'ca'), ('Nunavut', 'ca'), - ('Yukon', 'ca'); + ('Yukon', 'ca') ON CONFLICT (name) DO NOTHING; diff --git a/sql/de.sql b/sql/004_de.sql similarity index 95% rename from sql/de.sql rename to sql/004_de.sql index f694365..2ad9216 100644 --- a/sql/de.sql +++ b/sql/004_de.sql @@ -15,6 +15,6 @@ VALUES ('Saxony', 'de'), ('Saxony-Anhalt', 'de'), ('Schleswig-Holstein', 'de'), - ('Thuringia', 'de'); + ('Thuringia', 'de') ON CONFLICT (name) DO NOTHING; From 3887ac845e0f5535478432c44f9039137dfce5a2 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 12 Apr 2024 13:39:08 +0000 Subject: [PATCH 10/20] Add country regions for GB, FR, AR, CA, MX, and DE --- migrations/0014_wet_wong.sql | 1 + migrations/0015_nappy_spot.sql | 1 + migrations/meta/0014_snapshot.json | 319 ++++++++++++++++++++++++++++ migrations/meta/0015_snapshot.json | 326 +++++++++++++++++++++++++++++ migrations/meta/_journal.json | 14 ++ sql/002_us.sql | 105 +++++----- sql/003_ca.sql | 31 ++- sql/004_de.sql | 36 ++-- sql/005_fr.sql | 22 ++ sql/006_gb.sql | 8 + sql/007_ar.sql | 28 +++ sql/008_mx.sql | 35 ++++ sql/009_jp.sql | 51 +++++ src/lib/db/schema.ts | 3 +- 14 files changed, 891 insertions(+), 89 deletions(-) create mode 100644 migrations/0014_wet_wong.sql create mode 100644 migrations/0015_nappy_spot.sql create mode 100644 migrations/meta/0014_snapshot.json create mode 100644 migrations/meta/0015_snapshot.json create mode 100644 sql/005_fr.sql create mode 100644 sql/006_gb.sql create mode 100644 sql/007_ar.sql create mode 100644 sql/008_mx.sql create mode 100644 sql/009_jp.sql 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() From 61458b3cc231f1f4a012440a72c947bb0b571635 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 12 Apr 2024 14:04:23 +0000 Subject: [PATCH 11/20] Add country regions for Germany, South Africa, Australia, New Zealand, Egypt, Brazil, China --- migrations/0016_curvy_purple_man.sql | 1 + migrations/meta/0016_snapshot.json | 319 +++++++++++++++++++++++++++ migrations/meta/_journal.json | 7 + sql/004_de.sql | 2 +- sql/010_cn.sql | 35 +++ sql/011_in.sql | 39 ++++ sql/012_au.sql | 12 + sql/013_nz.sql | 20 ++ sql/014_za.sql | 13 ++ sql/015_eg.sql | 31 +++ sql/016_br.sql | 31 +++ src/lib/db/schema.ts | 2 +- 12 files changed, 510 insertions(+), 2 deletions(-) create mode 100644 migrations/0016_curvy_purple_man.sql create mode 100644 migrations/meta/0016_snapshot.json create mode 100644 sql/010_cn.sql create mode 100644 sql/011_in.sql create mode 100644 sql/012_au.sql create mode 100644 sql/013_nz.sql create mode 100644 sql/014_za.sql create mode 100644 sql/015_eg.sql create mode 100644 sql/016_br.sql diff --git a/migrations/0016_curvy_purple_man.sql b/migrations/0016_curvy_purple_man.sql new file mode 100644 index 0000000..b8c4b7e --- /dev/null +++ b/migrations/0016_curvy_purple_man.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelCountryRegions" DROP CONSTRAINT "worldTravelCountryRegions_name_unique"; \ No newline at end of file diff --git a/migrations/meta/0016_snapshot.json b/migrations/meta/0016_snapshot.json new file mode 100644 index 0000000..2e6b21b --- /dev/null +++ b/migrations/meta/0016_snapshot.json @@ -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": {} + } +} \ No newline at end of file diff --git a/migrations/meta/_journal.json b/migrations/meta/_journal.json index b703e7c..268be84 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -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 } ] } \ No newline at end of file diff --git a/sql/004_de.sql b/sql/004_de.sql index 311f67f..a8be86c 100644 --- a/sql/004_de.sql +++ b/sql/004_de.sql @@ -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; diff --git a/sql/010_cn.sql b/sql/010_cn.sql new file mode 100644 index 0000000..c7353ae --- /dev/null +++ b/sql/010_cn.sql @@ -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; diff --git a/sql/011_in.sql b/sql/011_in.sql new file mode 100644 index 0000000..45c76b6 --- /dev/null +++ b/sql/011_in.sql @@ -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; diff --git a/sql/012_au.sql b/sql/012_au.sql new file mode 100644 index 0000000..8882314 --- /dev/null +++ b/sql/012_au.sql @@ -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; diff --git a/sql/013_nz.sql b/sql/013_nz.sql new file mode 100644 index 0000000..9d20865 --- /dev/null +++ b/sql/013_nz.sql @@ -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; diff --git a/sql/014_za.sql b/sql/014_za.sql new file mode 100644 index 0000000..44b493c --- /dev/null +++ b/sql/014_za.sql @@ -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; diff --git a/sql/015_eg.sql b/sql/015_eg.sql new file mode 100644 index 0000000..21c5e66 --- /dev/null +++ b/sql/015_eg.sql @@ -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; diff --git a/sql/016_br.sql b/sql/016_br.sql new file mode 100644 index 0000000..6bbbd2b --- /dev/null +++ b/sql/016_br.sql @@ -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; diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index 2dc3661..f5830ed 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -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), From b0b8a2794b0ff760c9d9fab4218e72a3e101c35a Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 12 Apr 2024 14:20:34 +0000 Subject: [PATCH 12/20] Add flag column to worldTravelCountries table and remove flag column --- migrations/0017_thankful_kylun.sql | 1 + migrations/0018_melodic_fabian_cortez.sql | 1 + migrations/meta/0017_snapshot.json | 325 ++++++++++++++++++++++ migrations/meta/0018_snapshot.json | 319 +++++++++++++++++++++ migrations/meta/_journal.json | 14 + src/routes/worldtravel/+page.svelte | 16 +- 6 files changed, 673 insertions(+), 3 deletions(-) create mode 100644 migrations/0017_thankful_kylun.sql create mode 100644 migrations/0018_melodic_fabian_cortez.sql create mode 100644 migrations/meta/0017_snapshot.json create mode 100644 migrations/meta/0018_snapshot.json diff --git a/migrations/0017_thankful_kylun.sql b/migrations/0017_thankful_kylun.sql new file mode 100644 index 0000000..79c2845 --- /dev/null +++ b/migrations/0017_thankful_kylun.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelCountries" ADD COLUMN "flag" text; \ No newline at end of file diff --git a/migrations/0018_melodic_fabian_cortez.sql b/migrations/0018_melodic_fabian_cortez.sql new file mode 100644 index 0000000..c2a6815 --- /dev/null +++ b/migrations/0018_melodic_fabian_cortez.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelCountries" DROP COLUMN IF EXISTS "flag"; \ No newline at end of file diff --git a/migrations/meta/0017_snapshot.json b/migrations/meta/0017_snapshot.json new file mode 100644 index 0000000..f6dbc0f --- /dev/null +++ b/migrations/meta/0017_snapshot.json @@ -0,0 +1,325 @@ +{ + "id": "da14abf1-e425-4729-8f0a-de16628963d5", + "prevId": "4ec66da5-6bf4-41ac-b998-95f1e14a5372", + "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 + }, + "flag": { + "name": "flag", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "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": {} + } +} \ No newline at end of file diff --git a/migrations/meta/0018_snapshot.json b/migrations/meta/0018_snapshot.json new file mode 100644 index 0000000..c7509dd --- /dev/null +++ b/migrations/meta/0018_snapshot.json @@ -0,0 +1,319 @@ +{ + "id": "c200f3b3-43e2-4eff-97ff-ad9d9bf20d54", + "prevId": "da14abf1-e425-4729-8f0a-de16628963d5", + "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": {} + } +} \ No newline at end of file diff --git a/migrations/meta/_journal.json b/migrations/meta/_journal.json index 268be84..f822c99 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -120,6 +120,20 @@ "when": 1712930531576, "tag": "0016_curvy_purple_man", "breakpoints": true + }, + { + "idx": 17, + "version": "5", + "when": 1712930713274, + "tag": "0017_thankful_kylun", + "breakpoints": true + }, + { + "idx": 18, + "version": "5", + "when": 1712930841346, + "tag": "0018_melodic_fabian_cortez", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/routes/worldtravel/+page.svelte b/src/routes/worldtravel/+page.svelte index 8bf0b29..8f45bed 100644 --- a/src/routes/worldtravel/+page.svelte +++ b/src/routes/worldtravel/+page.svelte @@ -8,13 +8,23 @@ async function nav(loc: string) { goto(`/worldtravel/${loc}`); } + function getFlag(country: string) { + return `https://flagcdn.com/h24/${country}.png`; + } -

Country List

+

Country List

{#each data.response as item} - nav(item.country_code)} + >{item.name} + Flag {/each} From 0d84445791e23fc4807e3adf28143b8ce7cb3c42 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 12 Apr 2024 14:26:30 +0000 Subject: [PATCH 13/20] Update startup.sh script --- startup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/startup.sh b/startup.sh index 10039d0..289f773 100644 --- a/startup.sh +++ b/startup.sh @@ -32,7 +32,7 @@ echo "Starting AdventureLog" wait_for_db # generate the schema -npm run generate +# npm run generate # Run database migration npm run migrate From 11ace187a72fbe16457d97300b87027229b13940 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 12 Apr 2024 14:28:45 +0000 Subject: [PATCH 14/20] Add migration to drop unique constraint on worldTravelCountryRegions_id --- migrations/0019_elite_landau.sql | 1 + migrations/meta/0019_snapshot.json | 311 +++++++++++++++++++++++++++++ migrations/meta/_journal.json | 7 + src/lib/db/schema.ts | 2 +- 4 files changed, 320 insertions(+), 1 deletion(-) create mode 100644 migrations/0019_elite_landau.sql create mode 100644 migrations/meta/0019_snapshot.json diff --git a/migrations/0019_elite_landau.sql b/migrations/0019_elite_landau.sql new file mode 100644 index 0000000..e5e1e0f --- /dev/null +++ b/migrations/0019_elite_landau.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelCountryRegions" DROP CONSTRAINT "worldTravelCountryRegions_id_unique"; \ No newline at end of file diff --git a/migrations/meta/0019_snapshot.json b/migrations/meta/0019_snapshot.json new file mode 100644 index 0000000..272bd7c --- /dev/null +++ b/migrations/meta/0019_snapshot.json @@ -0,0 +1,311 @@ +{ + "id": "b2dfe1d2-0430-4405-ba82-18e197f1d12e", + "prevId": "c200f3b3-43e2-4eff-97ff-ad9d9bf20d54", + "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": {} + } + }, + "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 f822c99..6b2fc02 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -134,6 +134,13 @@ "when": 1712930841346, "tag": "0018_melodic_fabian_cortez", "breakpoints": true + }, + { + "idx": 19, + "version": "5", + "when": 1712932115102, + "tag": "0019_elite_landau", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index f5830ed..ea77814 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -61,7 +61,7 @@ export const worldTravelCountries = pgTable("worldTravelCountries", { }); export const worldTravelCountryRegions = pgTable("worldTravelCountryRegions", { - id: varchar("id").primaryKey().unique(), + id: varchar("id").primaryKey(), name: text("name").notNull(), country_code: text("country_code") .notNull() From fd1b85609e8a2a50c3aa7231cbbb1992827b37fa Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Sat, 13 Apr 2024 19:48:53 +0000 Subject: [PATCH 15/20] Remove unnecessary database migration scripts and update info modal text --- ...mic_the_fury.sql => 0000_hard_mach_iv.sql} | 32 +- migrations/0001_smart_cargill.sql | 1 - migrations/0002_glamorous_junta.sql | 11 - migrations/0003_nasty_onslaught.sql | 1 - migrations/0004_short_luke_cage.sql | 2 - migrations/0005_nervous_krista_starr.sql | 1 - migrations/0006_fuzzy_gamma_corps.sql | 1 - migrations/0007_youthful_shiver_man.sql | 1 - migrations/0008_safe_mordo.sql | 1 - migrations/0009_zippy_domino.sql | 11 - migrations/0010_closed_nicolaos.sql | 1 - migrations/0011_legal_red_hulk.sql | 1 - migrations/0012_slow_miracleman.sql | 2 - migrations/0013_high_unicorn.sql | 2 - migrations/0014_wet_wong.sql | 1 - migrations/0015_nappy_spot.sql | 1 - migrations/0016_curvy_purple_man.sql | 1 - migrations/0017_thankful_kylun.sql | 1 - migrations/0018_melodic_fabian_cortez.sql | 1 - migrations/0019_elite_landau.sql | 1 - migrations/meta/0000_snapshot.json | 97 +++++- migrations/meta/0001_snapshot.json | 253 -------------- migrations/meta/0002_snapshot.json | 295 ---------------- migrations/meta/0003_snapshot.json | 295 ---------------- migrations/meta/0004_snapshot.json | 295 ---------------- migrations/meta/0005_snapshot.json | 295 ---------------- migrations/meta/0006_snapshot.json | 295 ---------------- migrations/meta/0007_snapshot.json | 253 -------------- migrations/meta/0008_snapshot.json | 261 -------------- migrations/meta/0009_snapshot.json | 303 ---------------- migrations/meta/0010_snapshot.json | 311 ----------------- migrations/meta/0011_snapshot.json | 319 ----------------- migrations/meta/0012_snapshot.json | 319 ----------------- migrations/meta/0013_snapshot.json | 319 ----------------- migrations/meta/0014_snapshot.json | 319 ----------------- migrations/meta/0015_snapshot.json | 326 ------------------ migrations/meta/0016_snapshot.json | 319 ----------------- migrations/meta/0017_snapshot.json | 325 ----------------- migrations/meta/0018_snapshot.json | 319 ----------------- migrations/meta/0019_snapshot.json | 311 ----------------- migrations/meta/_journal.json | 137 +------- src/lib/components/InfoModal.svelte | 2 +- src/lib/components/Navbar.svelte | 8 +- src/lib/db/schema.ts | 10 + src/routes/log/+page.svelte | 7 - src/routes/worldtravel/+page.server.ts | 8 +- src/routes/worldtravel/+page.svelte | 1 - .../worldtravel/[countrycode]/+page.server.ts | 5 +- 48 files changed, 134 insertions(+), 5947 deletions(-) rename migrations/{0000_panoramic_the_fury.sql => 0000_hard_mach_iv.sql} (57%) delete mode 100644 migrations/0001_smart_cargill.sql delete mode 100644 migrations/0002_glamorous_junta.sql delete mode 100644 migrations/0003_nasty_onslaught.sql delete mode 100644 migrations/0004_short_luke_cage.sql delete mode 100644 migrations/0005_nervous_krista_starr.sql delete mode 100644 migrations/0006_fuzzy_gamma_corps.sql delete mode 100644 migrations/0007_youthful_shiver_man.sql delete mode 100644 migrations/0008_safe_mordo.sql delete mode 100644 migrations/0009_zippy_domino.sql delete mode 100644 migrations/0010_closed_nicolaos.sql delete mode 100644 migrations/0011_legal_red_hulk.sql delete mode 100644 migrations/0012_slow_miracleman.sql delete mode 100644 migrations/0013_high_unicorn.sql delete mode 100644 migrations/0014_wet_wong.sql delete mode 100644 migrations/0015_nappy_spot.sql delete mode 100644 migrations/0016_curvy_purple_man.sql delete mode 100644 migrations/0017_thankful_kylun.sql delete mode 100644 migrations/0018_melodic_fabian_cortez.sql delete mode 100644 migrations/0019_elite_landau.sql delete mode 100644 migrations/meta/0001_snapshot.json delete mode 100644 migrations/meta/0002_snapshot.json delete mode 100644 migrations/meta/0003_snapshot.json delete mode 100644 migrations/meta/0004_snapshot.json delete mode 100644 migrations/meta/0005_snapshot.json delete mode 100644 migrations/meta/0006_snapshot.json delete mode 100644 migrations/meta/0007_snapshot.json delete mode 100644 migrations/meta/0008_snapshot.json delete mode 100644 migrations/meta/0009_snapshot.json delete mode 100644 migrations/meta/0010_snapshot.json delete mode 100644 migrations/meta/0011_snapshot.json delete mode 100644 migrations/meta/0012_snapshot.json delete mode 100644 migrations/meta/0013_snapshot.json delete mode 100644 migrations/meta/0014_snapshot.json delete mode 100644 migrations/meta/0015_snapshot.json delete mode 100644 migrations/meta/0016_snapshot.json delete mode 100644 migrations/meta/0017_snapshot.json delete mode 100644 migrations/meta/0018_snapshot.json delete mode 100644 migrations/meta/0019_snapshot.json diff --git a/migrations/0000_panoramic_the_fury.sql b/migrations/0000_hard_mach_iv.sql similarity index 57% rename from migrations/0000_panoramic_the_fury.sql rename to migrations/0000_hard_mach_iv.sql index 0a49b25..5c9c0d1 100644 --- a/migrations/0000_panoramic_the_fury.sql +++ b/migrations/0000_hard_mach_iv.sql @@ -1,7 +1,8 @@ CREATE TABLE IF NOT EXISTS "featuredAdventures" ( "id" serial PRIMARY KEY NOT NULL, "name" text NOT NULL, - "location" text + "location" text, + CONSTRAINT "featuredAdventures_name_unique" UNIQUE("name") ); --> statement-breakpoint CREATE TABLE IF NOT EXISTS "session" ( @@ -34,17 +35,24 @@ CREATE TABLE IF NOT EXISTS "userVisitedAdventures" ( "visited_date" text ); --> statement-breakpoint +CREATE TABLE IF NOT EXISTS "userVisitedWorldTravel" ( + "id" serial PRIMARY KEY NOT NULL, + "user_id" text NOT NULL, + "region_id" varchar NOT NULL +); +--> statement-breakpoint CREATE TABLE IF NOT EXISTS "worldTravelCountries" ( "id" serial PRIMARY KEY NOT NULL, "name" text NOT NULL, "country_code" text NOT NULL, - "continent" text NOT NULL + "continent" text NOT NULL, + CONSTRAINT "worldTravelCountries_country_code_unique" UNIQUE("country_code") ); --> statement-breakpoint -CREATE TABLE IF NOT EXISTS "worldTravelRegions" ( - "id" serial PRIMARY KEY NOT NULL, +CREATE TABLE IF NOT EXISTS "worldTravelCountryRegions" ( + "id" varchar PRIMARY KEY NOT NULL, "name" text NOT NULL, - "country_id" text NOT NULL + "country_code" text NOT NULL ); --> statement-breakpoint DO $$ BEGIN @@ -60,7 +68,19 @@ EXCEPTION END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "worldTravelRegions" ADD CONSTRAINT "worldTravelRegions_country_id_worldTravelCountries_id_fk" FOREIGN KEY ("country_id") REFERENCES "worldTravelCountries"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "userVisitedWorldTravel" ADD CONSTRAINT "userVisitedWorldTravel_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "userVisitedWorldTravel" ADD CONSTRAINT "userVisitedWorldTravel_region_id_worldTravelCountryRegions_id_fk" FOREIGN KEY ("region_id") REFERENCES "worldTravelCountryRegions"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "worldTravelCountryRegions" ADD CONSTRAINT "worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk" FOREIGN KEY ("country_code") REFERENCES "worldTravelCountries"("country_code") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; diff --git a/migrations/0001_smart_cargill.sql b/migrations/0001_smart_cargill.sql deleted file mode 100644 index 4c29cad..0000000 --- a/migrations/0001_smart_cargill.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE "worldTravelRegions"; \ No newline at end of file diff --git a/migrations/0002_glamorous_junta.sql b/migrations/0002_glamorous_junta.sql deleted file mode 100644 index 18653c4..0000000 --- a/migrations/0002_glamorous_junta.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE IF NOT EXISTS "worldTravelRegions" ( - "id" serial PRIMARY KEY NOT NULL, - "name" text NOT NULL, - "country_id" text NOT NULL -); ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "worldTravelRegions" ADD CONSTRAINT "worldTravelRegions_country_id_worldTravelCountries_id_fk" FOREIGN KEY ("country_id") REFERENCES "worldTravelCountries"("id") ON DELETE no action ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; diff --git a/migrations/0003_nasty_onslaught.sql b/migrations/0003_nasty_onslaught.sql deleted file mode 100644 index e9faf11..0000000 --- a/migrations/0003_nasty_onslaught.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "worldTravelRegions" ALTER COLUMN "country_id" SET DATA TYPE serial; \ No newline at end of file diff --git a/migrations/0004_short_luke_cage.sql b/migrations/0004_short_luke_cage.sql deleted file mode 100644 index 4e6e152..0000000 --- a/migrations/0004_short_luke_cage.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "worldTravelRegions" ALTER COLUMN "id" SET DATA TYPE text;--> statement-breakpoint -ALTER TABLE "worldTravelRegions" ALTER COLUMN "country_id" SET DATA TYPE text; \ No newline at end of file diff --git a/migrations/0005_nervous_krista_starr.sql b/migrations/0005_nervous_krista_starr.sql deleted file mode 100644 index 1cd4bab..0000000 --- a/migrations/0005_nervous_krista_starr.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "worldTravelRegions" ALTER COLUMN "country_id" SET DATA TYPE integer; \ No newline at end of file diff --git a/migrations/0006_fuzzy_gamma_corps.sql b/migrations/0006_fuzzy_gamma_corps.sql deleted file mode 100644 index 47b3cec..0000000 --- a/migrations/0006_fuzzy_gamma_corps.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "worldTravelRegions" ALTER COLUMN "id" SET DATA TYPE serial; \ No newline at end of file diff --git a/migrations/0007_youthful_shiver_man.sql b/migrations/0007_youthful_shiver_man.sql deleted file mode 100644 index 4c29cad..0000000 --- a/migrations/0007_youthful_shiver_man.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE "worldTravelRegions"; \ No newline at end of file diff --git a/migrations/0008_safe_mordo.sql b/migrations/0008_safe_mordo.sql deleted file mode 100644 index af48707..0000000 --- a/migrations/0008_safe_mordo.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "worldTravelCountries" ADD CONSTRAINT "worldTravelCountries_country_code_unique" UNIQUE("country_code"); \ No newline at end of file diff --git a/migrations/0009_zippy_domino.sql b/migrations/0009_zippy_domino.sql deleted file mode 100644 index c62f6f2..0000000 --- a/migrations/0009_zippy_domino.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE IF NOT EXISTS "worldTravelCountryRegions" ( - "id" serial PRIMARY KEY NOT NULL, - "name" text NOT NULL, - "country_code" text NOT NULL -); ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "worldTravelCountryRegions" ADD CONSTRAINT "worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk" FOREIGN KEY ("country_code") REFERENCES "worldTravelCountries"("country_code") ON DELETE no action ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; diff --git a/migrations/0010_closed_nicolaos.sql b/migrations/0010_closed_nicolaos.sql deleted file mode 100644 index 3f0f4f0..0000000 --- a/migrations/0010_closed_nicolaos.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "featuredAdventures" ADD CONSTRAINT "featuredAdventures_name_unique" UNIQUE("name"); \ No newline at end of file diff --git a/migrations/0011_legal_red_hulk.sql b/migrations/0011_legal_red_hulk.sql deleted file mode 100644 index 7f6cdfa..0000000 --- a/migrations/0011_legal_red_hulk.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "worldTravelCountryRegions" ADD CONSTRAINT "worldTravelCountryRegions_name_unique" UNIQUE("name"); \ No newline at end of file diff --git a/migrations/0012_slow_miracleman.sql b/migrations/0012_slow_miracleman.sql deleted file mode 100644 index 40df603..0000000 --- a/migrations/0012_slow_miracleman.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "worldTravelCountries" DROP CONSTRAINT "worldTravelCountries_country_code_unique";--> statement-breakpoint -ALTER TABLE "worldTravelCountries" ADD CONSTRAINT "worldTravelCountries_name_unique" UNIQUE("name"); \ No newline at end of file diff --git a/migrations/0013_high_unicorn.sql b/migrations/0013_high_unicorn.sql deleted file mode 100644 index f9a2cd5..0000000 --- a/migrations/0013_high_unicorn.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "worldTravelCountries" DROP CONSTRAINT "worldTravelCountries_name_unique";--> statement-breakpoint -ALTER TABLE "worldTravelCountries" ADD CONSTRAINT "worldTravelCountries_country_code_unique" UNIQUE("country_code"); \ No newline at end of file diff --git a/migrations/0014_wet_wong.sql b/migrations/0014_wet_wong.sql deleted file mode 100644 index 203285b..0000000 --- a/migrations/0014_wet_wong.sql +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index fdc5115..0000000 --- a/migrations/0015_nappy_spot.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "worldTravelCountryRegions" ADD CONSTRAINT "worldTravelCountryRegions_id_unique" UNIQUE("id"); \ No newline at end of file diff --git a/migrations/0016_curvy_purple_man.sql b/migrations/0016_curvy_purple_man.sql deleted file mode 100644 index b8c4b7e..0000000 --- a/migrations/0016_curvy_purple_man.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "worldTravelCountryRegions" DROP CONSTRAINT "worldTravelCountryRegions_name_unique"; \ No newline at end of file diff --git a/migrations/0017_thankful_kylun.sql b/migrations/0017_thankful_kylun.sql deleted file mode 100644 index 79c2845..0000000 --- a/migrations/0017_thankful_kylun.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "worldTravelCountries" ADD COLUMN "flag" text; \ No newline at end of file diff --git a/migrations/0018_melodic_fabian_cortez.sql b/migrations/0018_melodic_fabian_cortez.sql deleted file mode 100644 index c2a6815..0000000 --- a/migrations/0018_melodic_fabian_cortez.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "worldTravelCountries" DROP COLUMN IF EXISTS "flag"; \ No newline at end of file diff --git a/migrations/0019_elite_landau.sql b/migrations/0019_elite_landau.sql deleted file mode 100644 index e5e1e0f..0000000 --- a/migrations/0019_elite_landau.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "worldTravelCountryRegions" DROP CONSTRAINT "worldTravelCountryRegions_id_unique"; \ No newline at end of file diff --git a/migrations/meta/0000_snapshot.json b/migrations/meta/0000_snapshot.json index ecf5508..f038117 100644 --- a/migrations/meta/0000_snapshot.json +++ b/migrations/meta/0000_snapshot.json @@ -1,5 +1,5 @@ { - "id": "9341b0b9-3e38-4043-bc4e-5655d8f0a953", + "id": "b6ab23b7-42f0-4475-aa5d-23b92c00e97f", "prevId": "00000000-0000-0000-0000-000000000000", "version": "5", "dialect": "pg", @@ -30,7 +30,15 @@ "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "uniqueConstraints": { + "featuredAdventures_name_unique": { + "name": "featuredAdventures_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + } }, "session": { "name": "session", @@ -208,6 +216,61 @@ "compositePrimaryKeys": {}, "uniqueConstraints": {} }, + "userVisitedWorldTravel": { + "name": "userVisitedWorldTravel", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "region_id": { + "name": "region_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "userVisitedWorldTravel_user_id_user_id_fk": { + "name": "userVisitedWorldTravel_user_id_user_id_fk", + "tableFrom": "userVisitedWorldTravel", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "userVisitedWorldTravel_region_id_worldTravelCountryRegions_id_fk": { + "name": "userVisitedWorldTravel_region_id_worldTravelCountryRegions_id_fk", + "tableFrom": "userVisitedWorldTravel", + "tableTo": "worldTravelCountryRegions", + "columnsFrom": [ + "region_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, "worldTravelCountries": { "name": "worldTravelCountries", "schema": "", @@ -240,15 +303,23 @@ "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "uniqueConstraints": { + "worldTravelCountries_country_code_unique": { + "name": "worldTravelCountries_country_code_unique", + "nullsNotDistinct": false, + "columns": [ + "country_code" + ] + } + } }, - "worldTravelRegions": { - "name": "worldTravelRegions", + "worldTravelCountryRegions": { + "name": "worldTravelCountryRegions", "schema": "", "columns": { "id": { "name": "id", - "type": "serial", + "type": "varchar", "primaryKey": true, "notNull": true }, @@ -258,8 +329,8 @@ "primaryKey": false, "notNull": true }, - "country_id": { - "name": "country_id", + "country_code": { + "name": "country_code", "type": "text", "primaryKey": false, "notNull": true @@ -267,15 +338,15 @@ }, "indexes": {}, "foreignKeys": { - "worldTravelRegions_country_id_worldTravelCountries_id_fk": { - "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", - "tableFrom": "worldTravelRegions", + "worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk": { + "name": "worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk", + "tableFrom": "worldTravelCountryRegions", "tableTo": "worldTravelCountries", "columnsFrom": [ - "country_id" + "country_code" ], "columnsTo": [ - "id" + "country_code" ], "onDelete": "no action", "onUpdate": "no action" diff --git a/migrations/meta/0001_snapshot.json b/migrations/meta/0001_snapshot.json deleted file mode 100644 index 862a31e..0000000 --- a/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "id": "125fff71-fcac-407b-b811-cdc6cf7931b0", - "prevId": "9341b0b9-3e38-4043-bc4e-5655d8f0a953", - "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": {} - }, - "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": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0002_snapshot.json b/migrations/meta/0002_snapshot.json deleted file mode 100644 index 054374a..0000000 --- a/migrations/meta/0002_snapshot.json +++ /dev/null @@ -1,295 +0,0 @@ -{ - "id": "88f059b3-b83f-4031-b2f1-89401d74ad1b", - "prevId": "125fff71-fcac-407b-b811-cdc6cf7931b0", - "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": {} - }, - "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": {} - }, - "worldTravelRegions": { - "name": "worldTravelRegions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "country_id": { - "name": "country_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "worldTravelRegions_country_id_worldTravelCountries_id_fk": { - "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", - "tableFrom": "worldTravelRegions", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0003_snapshot.json b/migrations/meta/0003_snapshot.json deleted file mode 100644 index 0b80ab5..0000000 --- a/migrations/meta/0003_snapshot.json +++ /dev/null @@ -1,295 +0,0 @@ -{ - "id": "e6295a91-815f-4f5e-8e1c-f83901c9b8d1", - "prevId": "88f059b3-b83f-4031-b2f1-89401d74ad1b", - "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": {} - }, - "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": {} - }, - "worldTravelRegions": { - "name": "worldTravelRegions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "country_id": { - "name": "country_id", - "type": "serial", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "worldTravelRegions_country_id_worldTravelCountries_id_fk": { - "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", - "tableFrom": "worldTravelRegions", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0004_snapshot.json b/migrations/meta/0004_snapshot.json deleted file mode 100644 index a895a77..0000000 --- a/migrations/meta/0004_snapshot.json +++ /dev/null @@ -1,295 +0,0 @@ -{ - "id": "ca4d65ff-ab48-476d-8494-27a21ac0fcf4", - "prevId": "e6295a91-815f-4f5e-8e1c-f83901c9b8d1", - "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": {} - }, - "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": {} - }, - "worldTravelRegions": { - "name": "worldTravelRegions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "country_id": { - "name": "country_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "worldTravelRegions_country_id_worldTravelCountries_id_fk": { - "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", - "tableFrom": "worldTravelRegions", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0005_snapshot.json b/migrations/meta/0005_snapshot.json deleted file mode 100644 index b301016..0000000 --- a/migrations/meta/0005_snapshot.json +++ /dev/null @@ -1,295 +0,0 @@ -{ - "id": "f19bd92c-115d-4f2e-a3be-31ece1ba07b0", - "prevId": "ca4d65ff-ab48-476d-8494-27a21ac0fcf4", - "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": {} - }, - "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": {} - }, - "worldTravelRegions": { - "name": "worldTravelRegions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "country_id": { - "name": "country_id", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "worldTravelRegions_country_id_worldTravelCountries_id_fk": { - "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", - "tableFrom": "worldTravelRegions", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0006_snapshot.json b/migrations/meta/0006_snapshot.json deleted file mode 100644 index 447088a..0000000 --- a/migrations/meta/0006_snapshot.json +++ /dev/null @@ -1,295 +0,0 @@ -{ - "id": "1cfee0e3-3270-431c-9045-4938e0d02935", - "prevId": "f19bd92c-115d-4f2e-a3be-31ece1ba07b0", - "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": {} - }, - "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": {} - }, - "worldTravelRegions": { - "name": "worldTravelRegions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "country_id": { - "name": "country_id", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "worldTravelRegions_country_id_worldTravelCountries_id_fk": { - "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", - "tableFrom": "worldTravelRegions", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0007_snapshot.json b/migrations/meta/0007_snapshot.json deleted file mode 100644 index 4c284d4..0000000 --- a/migrations/meta/0007_snapshot.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "id": "d395e6d3-0873-4815-8875-f1c2ce0c3571", - "prevId": "1cfee0e3-3270-431c-9045-4938e0d02935", - "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": {} - }, - "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": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0008_snapshot.json b/migrations/meta/0008_snapshot.json deleted file mode 100644 index 3a784ef..0000000 --- a/migrations/meta/0008_snapshot.json +++ /dev/null @@ -1,261 +0,0 @@ -{ - "id": "8b58d463-f4b8-4e19-bbf5-338c16470029", - "prevId": "d395e6d3-0873-4815-8875-f1c2ce0c3571", - "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": {} - }, - "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" - ] - } - } - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0009_snapshot.json b/migrations/meta/0009_snapshot.json deleted file mode 100644 index 8fb5571..0000000 --- a/migrations/meta/0009_snapshot.json +++ /dev/null @@ -1,303 +0,0 @@ -{ - "id": "309515d8-823e-493d-96c2-aef7ff79a953", - "prevId": "8b58d463-f4b8-4e19-bbf5-338c16470029", - "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": {} - }, - "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": "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 - } - }, - "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": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0010_snapshot.json b/migrations/meta/0010_snapshot.json deleted file mode 100644 index 8824345..0000000 --- a/migrations/meta/0010_snapshot.json +++ /dev/null @@ -1,311 +0,0 @@ -{ - "id": "988ebc41-0384-43ed-a4dc-acaf5f14f88b", - "prevId": "309515d8-823e-493d-96c2-aef7ff79a953", - "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": "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 - } - }, - "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": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0011_snapshot.json b/migrations/meta/0011_snapshot.json deleted file mode 100644 index 762a976..0000000 --- a/migrations/meta/0011_snapshot.json +++ /dev/null @@ -1,319 +0,0 @@ -{ - "id": "341b817a-4a1f-43ea-9e49-34769fca6da8", - "prevId": "988ebc41-0384-43ed-a4dc-acaf5f14f88b", - "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": "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 - } - }, - "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/0012_snapshot.json b/migrations/meta/0012_snapshot.json deleted file mode 100644 index e214bd7..0000000 --- a/migrations/meta/0012_snapshot.json +++ /dev/null @@ -1,319 +0,0 @@ -{ - "id": "3ea6cd28-ab73-49f1-be48-fdacff1559e2", - "prevId": "341b817a-4a1f-43ea-9e49-34769fca6da8", - "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_name_unique": { - "name": "worldTravelCountries_name_unique", - "nullsNotDistinct": false, - "columns": [ - "name" - ] - } - } - }, - "worldTravelCountryRegions": { - "name": "worldTravelCountryRegions", - "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 - } - }, - "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/0013_snapshot.json b/migrations/meta/0013_snapshot.json deleted file mode 100644 index fc97e05..0000000 --- a/migrations/meta/0013_snapshot.json +++ /dev/null @@ -1,319 +0,0 @@ -{ - "id": "09cc6e72-191b-4579-ad62-e24dbc03bacf", - "prevId": "3ea6cd28-ab73-49f1-be48-fdacff1559e2", - "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": "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 - } - }, - "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/0014_snapshot.json b/migrations/meta/0014_snapshot.json deleted file mode 100644 index 20f4015..0000000 --- a/migrations/meta/0014_snapshot.json +++ /dev/null @@ -1,319 +0,0 @@ -{ - "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 deleted file mode 100644 index b455656..0000000 --- a/migrations/meta/0015_snapshot.json +++ /dev/null @@ -1,326 +0,0 @@ -{ - "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/0016_snapshot.json b/migrations/meta/0016_snapshot.json deleted file mode 100644 index 2e6b21b..0000000 --- a/migrations/meta/0016_snapshot.json +++ /dev/null @@ -1,319 +0,0 @@ -{ - "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": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0017_snapshot.json b/migrations/meta/0017_snapshot.json deleted file mode 100644 index f6dbc0f..0000000 --- a/migrations/meta/0017_snapshot.json +++ /dev/null @@ -1,325 +0,0 @@ -{ - "id": "da14abf1-e425-4729-8f0a-de16628963d5", - "prevId": "4ec66da5-6bf4-41ac-b998-95f1e14a5372", - "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 - }, - "flag": { - "name": "flag", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "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": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0018_snapshot.json b/migrations/meta/0018_snapshot.json deleted file mode 100644 index c7509dd..0000000 --- a/migrations/meta/0018_snapshot.json +++ /dev/null @@ -1,319 +0,0 @@ -{ - "id": "c200f3b3-43e2-4eff-97ff-ad9d9bf20d54", - "prevId": "da14abf1-e425-4729-8f0a-de16628963d5", - "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": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0019_snapshot.json b/migrations/meta/0019_snapshot.json deleted file mode 100644 index 272bd7c..0000000 --- a/migrations/meta/0019_snapshot.json +++ /dev/null @@ -1,311 +0,0 @@ -{ - "id": "b2dfe1d2-0430-4405-ba82-18e197f1d12e", - "prevId": "c200f3b3-43e2-4eff-97ff-ad9d9bf20d54", - "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": {} - } - }, - "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 6b2fc02..ce56d99 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -5,141 +5,8 @@ { "idx": 0, "version": "5", - "when": 1712879281600, - "tag": "0000_panoramic_the_fury", - "breakpoints": true - }, - { - "idx": 1, - "version": "5", - "when": 1712879301598, - "tag": "0001_smart_cargill", - "breakpoints": true - }, - { - "idx": 2, - "version": "5", - "when": 1712879457439, - "tag": "0002_glamorous_junta", - "breakpoints": true - }, - { - "idx": 3, - "version": "5", - "when": 1712879488661, - "tag": "0003_nasty_onslaught", - "breakpoints": true - }, - { - "idx": 4, - "version": "5", - "when": 1712879540659, - "tag": "0004_short_luke_cage", - "breakpoints": true - }, - { - "idx": 5, - "version": "5", - "when": 1712879605930, - "tag": "0005_nervous_krista_starr", - "breakpoints": true - }, - { - "idx": 6, - "version": "5", - "when": 1712879813045, - "tag": "0006_fuzzy_gamma_corps", - "breakpoints": true - }, - { - "idx": 7, - "version": "5", - "when": 1712879875868, - "tag": "0007_youthful_shiver_man", - "breakpoints": true - }, - { - "idx": 8, - "version": "5", - "when": 1712880065046, - "tag": "0008_safe_mordo", - "breakpoints": true - }, - { - "idx": 9, - "version": "5", - "when": 1712880141763, - "tag": "0009_zippy_domino", - "breakpoints": true - }, - { - "idx": 10, - "version": "5", - "when": 1712884724835, - "tag": "0010_closed_nicolaos", - "breakpoints": true - }, - { - "idx": 11, - "version": "5", - "when": 1712885083355, - "tag": "0011_legal_red_hulk", - "breakpoints": true - }, - { - "idx": 12, - "version": "5", - "when": 1712886238567, - "tag": "0012_slow_miracleman", - "breakpoints": true - }, - { - "idx": 13, - "version": "5", - "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 - }, - { - "idx": 16, - "version": "5", - "when": 1712930531576, - "tag": "0016_curvy_purple_man", - "breakpoints": true - }, - { - "idx": 17, - "version": "5", - "when": 1712930713274, - "tag": "0017_thankful_kylun", - "breakpoints": true - }, - { - "idx": 18, - "version": "5", - "when": 1712930841346, - "tag": "0018_melodic_fabian_cortez", - "breakpoints": true - }, - { - "idx": 19, - "version": "5", - "when": 1712932115102, - "tag": "0019_elite_landau", + "when": 1713037717607, + "tag": "0000_hard_mach_iv", "breakpoints": true } ] diff --git a/src/lib/components/InfoModal.svelte b/src/lib/components/InfoModal.svelte index abcae56..ea8e428 100644 --- a/src/lib/components/InfoModal.svelte +++ b/src/lib/components/InfoModal.svelte @@ -50,7 +50,7 @@ class="text-primary-500 underline">Source Code

-

Made with ❤️ in Connecticut.

+

Made with ❤️ in the United States.

{/if} + +{#if type === "worldtravelregion"} +
+
+

{name}

+
+ +
+
+
+{/if} diff --git a/src/lib/index.ts b/src/lib/index.ts index 44323dc..f8d4e9b 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1,4 +1,43 @@ // place files you want to import through the `$lib` alias in this folder. +export function countryCodeToName(countryCode: string) { + switch (countryCode) { + case "us": + return "United States"; + case "de": + return "Germany"; + case "fr": + return "France"; + case "gb": + return "United Kingdom"; + case "ar": + return "Argentina"; + case "mx": + return "Mexico"; + case "jp": + return "Japan"; + case "cn": + return "China"; + case "in": + return "India"; + case "au": + return "Australia"; + case "nz": + return "New Zealand"; + case "za": + return "South Africa"; + case "eg": + return "Egypt"; + case "ca": + return "Canada"; + case "br": + return "Brazil"; + } +} + +export function getFlag(country: string) { + return `https://flagcdn.com/h24/${country}.png`; +} + export function generateRandomString() { let randomString = ""; const digits = diff --git a/src/routes/worldtravel/+page.svelte b/src/routes/worldtravel/+page.svelte index 379de26..d8eb927 100644 --- a/src/routes/worldtravel/+page.svelte +++ b/src/routes/worldtravel/+page.svelte @@ -1,5 +1,6 @@

Country List

diff --git a/src/routes/worldtravel/[countrycode]/+page.server.ts b/src/routes/worldtravel/[countrycode]/+page.server.ts index 7ad6617..56828e0 100644 --- a/src/routes/worldtravel/[countrycode]/+page.server.ts +++ b/src/routes/worldtravel/[countrycode]/+page.server.ts @@ -13,5 +13,6 @@ export const load: PageServerLoad = async ({ params, locals }) => { .where(eq(worldTravelCountryRegions.country_code, countrycode)) return { regions : data, + countrycode: countrycode, }; } \ No newline at end of file diff --git a/src/routes/worldtravel/[countrycode]/+page.svelte b/src/routes/worldtravel/[countrycode]/+page.svelte index 86c8d74..515b62d 100644 --- a/src/routes/worldtravel/[countrycode]/+page.svelte +++ b/src/routes/worldtravel/[countrycode]/+page.svelte @@ -1,7 +1,23 @@ -{#each data.regions as region} -

{region.name}

-{/each} +

+ Regions in {countryCodeToName(data.countrycode)} + Flag +

+ +
+ {#each data.regions as region} + + {/each} +
From 8a169da9e29887745b20225480c19e3dc1eca740 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Sat, 13 Apr 2024 20:39:06 +0000 Subject: [PATCH 17/20] Update getFlag function to accept size parameter --- src/lib/index.ts | 10 ++++++++-- src/routes/worldtravel/+page.svelte | 2 +- src/routes/worldtravel/[countrycode]/+page.svelte | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/lib/index.ts b/src/lib/index.ts index f8d4e9b..b3d3898 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -34,8 +34,14 @@ export function countryCodeToName(countryCode: string) { } } -export function getFlag(country: string) { - return `https://flagcdn.com/h24/${country}.png`; +/** + * Generates the URL for a flag image based on the specified size and country code. + * @param size - The desired height of the flag image. Avaliable sizes: 20, 24, 40, 60, 80, 120, 240. + * @param country - The 2 digit country code representing the desired flag. + * @returns The URL of the flag image. + */ +export function getFlag(size:number,country: string) { + return `https://flagcdn.com/h${size}/${country}.png`; } export function generateRandomString() { diff --git a/src/routes/worldtravel/+page.svelte b/src/routes/worldtravel/+page.svelte index d8eb927..f69c48f 100644 --- a/src/routes/worldtravel/+page.svelte +++ b/src/routes/worldtravel/+page.svelte @@ -18,7 +18,7 @@ on:click={() => nav(item.country_code)} >{item.name} Flag Regions in {countryCodeToName(data.countrycode)} Flag From b2210dc7c977628350989855b23347f75caa55b2 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Sat, 13 Apr 2024 21:03:59 +0000 Subject: [PATCH 18/20] Update login and signup pages, and add countries.json --- src/lib/index.ts | 131 +++++----------------- src/lib/json/countries.json | 17 +++ src/lib/json/quotes.json | 192 +++++++++++++++++++++++++++++++++ src/routes/login/+page.svelte | 2 +- src/routes/signup/+page.svelte | 2 +- 5 files changed, 237 insertions(+), 107 deletions(-) create mode 100644 src/lib/json/countries.json create mode 100644 src/lib/json/quotes.json diff --git a/src/lib/index.ts b/src/lib/index.ts index b3d3898..cc1f350 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1,37 +1,16 @@ -// place files you want to import through the `$lib` alias in this folder. -export function countryCodeToName(countryCode: string) { - switch (countryCode) { - case "us": - return "United States"; - case "de": - return "Germany"; - case "fr": - return "France"; - case "gb": - return "United Kingdom"; - case "ar": - return "Argentina"; - case "mx": - return "Mexico"; - case "jp": - return "Japan"; - case "cn": - return "China"; - case "in": - return "India"; - case "au": - return "Australia"; - case "nz": - return "New Zealand"; - case "za": - return "South Africa"; - case "eg": - return "Egypt"; - case "ca": - return "Canada"; - case "br": - return "Brazil"; - } +import inspirationalQuotes from "./json/quotes.json"; +import countryCodes from "./json/countries.json"; + +/** + * Converts a country code to its corresponding country name. + * @param countryCode - The country code to convert. + * @returns The country name if found, otherwise null. + */ +export function countryCodeToName(countryCode: string): string | null { + // Look up the country name using the provided country code + const countryName = countryCodes[countryCode.toLowerCase() as keyof typeof countryCodes]; + // Return the country name if found, otherwise return null + return countryName || null; } /** @@ -44,6 +23,10 @@ export function getFlag(size:number,country: string) { return `https://flagcdn.com/h${size}/${country}.png`; } +/** + * Generates a random string consisting of alphanumeric characters. + * @returns {string} The randomly generated string. + */ export function generateRandomString() { let randomString = ""; const digits = @@ -56,76 +39,14 @@ export function generateRandomString() { return randomString; } -const inspirationalQuotes = [ - "Believe you can and you're halfway there. - Theodore Roosevelt", - "The only way to do great work is to love what you do. - Steve Jobs", - "In the middle of every difficulty lies opportunity. - Albert Einstein", - "The future belongs to those who believe in the beauty of their dreams. - Eleanor Roosevelt", - "It does not matter how slowly you go as long as you do not stop. - Confucius", - "Success is not final, failure is not fatal: It is the courage to continue that counts. - Winston Churchill", - "The only limit to our realization of tomorrow will be our doubts of today. - Franklin D. Roosevelt", - "Don't watch the clock; do what it does. Keep going. - Sam Levenson", - "You are never too old to set another goal or to dream a new dream. - C.S. Lewis", - "The only person you are destined to become is the person you decide to be. - Ralph Waldo Emerson", - "Happiness is not something ready-made. It comes from your own actions. - Dalai Lama", - "Life is what happens when you're busy making other plans. - John Lennon", - "You miss 100% of the shots you don't take. - Wayne Gretzky", - "The best time to plant a tree was 20 years ago. The second best time is now. - Chinese Proverb", - "The only way to achieve the impossible is to believe it is possible. - Charles Kingsleigh", - "Don't count the days, make the days count. - Muhammad Ali", - "You don't have to be great to start, but you have to start to be great. - Zig Ziglar", - "You can't go back and change the beginning, but you can start where you are and change the ending. - C.S. Lewis", - "Dream big and dare to fail. - Norman Vaughan", - "The secret of getting ahead is getting started. - Mark Twain", - "Everything you can imagine is real. - Pablo Picasso", - "You must be the change you wish to see in the world. - Mahatma Gandhi", - "If you want to lift yourself up, lift up someone else. - Booker T. Washington", - "Believe in yourself and all that you are. Know that there is something inside you that is greater than any obstacle. - Christian D. Larson", - "The journey of a thousand miles begins with one step. - Lao Tzu", - "Life isn't about waiting for the storm to pass, it's about learning to dance in the rain. - Vivian Greene", - "You are never too old to set another goal or to dream a new dream. - Les Brown", - "Your time is limited, don't waste it living someone else's life. - Steve Jobs", - "Don't let yesterday take up too much of today. - Will Rogers", - "The only thing standing between you and your goal is the story you keep telling yourself as to why you can't achieve it. - Jordan Belfort", - "The future belongs to those who prepare for it today. - Malcolm X", - "The greatest glory in living lies not in never falling, but in rising every time we fall. - Nelson Mandela", - "It's not what happens to you, but how you react to it that matters. - Epictetus", - "The only way to do great work is to love what you do. - Steve Jobs", - "When one door of happiness closes, another opens, but often we look so long at the closed door that we do not see the one that has been opened for us. - Helen Keller", - "The only thing that stands between you and your dream is the will to try and the belief that it is actually possible. - Joel Brown", - "Success is walking from failure to failure with no loss of enthusiasm. - Winston Churchill", - "Believe in yourself! Have faith in your abilities! Without a humble but reasonable confidence in your own powers you cannot be successful or happy. - Norman Vincent Peale", - "The greatest adventure is what lies ahead. - J.R.R. Tolkien", - "The only way to do great work is to love what you do. - Steve Jobs", - "What you get by achieving your goals is not as important as what you become by achieving your goals. - Zig Ziglar", - "To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment. - Ralph Waldo Emerson", - "What lies behind us and what lies before us are tiny matters compared to what lies within us. - Ralph Waldo Emerson", - "The only person you are destined to become is the person you decide to be. - Ralph Waldo Emerson", - "The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart. - Helen Keller", - "The only limit to our realization of tomorrow will be our doubts of today. - Franklin D. Roosevelt", - "It always seems impossible until it is done. - Nelson Mandela", - "I can't change the direction of the wind, but I can adjust my sails to always reach my destination. - Jimmy Dean", - "Believe you can and you're halfway there. - Theodore Roosevelt", - "The only way to achieve the impossible is to believe it is possible. - Charles Kingsleigh", - "If you're going through hell, keep going. - Winston Churchill", - "Nothing is impossible, the word itself says 'I'm possible'! - Audrey Hepburn", - "The only thing standing in the way between you and your goal is the story you keep telling yourself as to why you can't achieve it. - Jordan Belfort", - "The future belongs to those who believe in the beauty of their dreams. - Eleanor Roosevelt", - "Success is not final, failure is not fatal: It is the courage to continue that counts. - Winston Churchill", - "Keep your face always toward the sunshine - and shadows will fall behind you. - Walt Whitman", - "Success is not the key to happiness. Happiness is the key to success. If you love what you are doing, you will be successful. - Albert Schweitzer", - "Don't watch the clock; do what it does. Keep going. - Sam Levenson", - "You are never too old to set another goal or to dream a new dream. - C.S. Lewis", - "You are never too old to set another goal or to dream a new dream. - C.S. Lewis", - "The only person you are destined to become is the person you decide to be. - Ralph Waldo Emerson", - "Happiness is not something ready-made. It comes from your own actions. - Dalai Lama", - "Life is what happens when you're busy making other plans. - John Lennon", - "You miss 100% of the shots you don't take. - Wayne Gretzky", - "The best time to plant a tree was 20 years ago. The second best time is now. - Chinese Proverb", - "The only way to achieve the impossible is to believe it is possible. - Charles Kings", -]; - +const quotes = inspirationalQuotes.quotes; +/** + * Retrieves a random quote from the quotes array. + * @returns A formatted string containing the random quote and its author. + */ export function getRandomQuote() { - const randomIndex = Math.floor(Math.random() * inspirationalQuotes.length); - return inspirationalQuotes[randomIndex]; + const randomIndex = Math.floor(Math.random() * quotes.length); + let quoteString = quotes[randomIndex].quote; + let authorString = quotes[randomIndex].author; + return "\"" + quoteString + "\" - " + authorString; } diff --git a/src/lib/json/countries.json b/src/lib/json/countries.json new file mode 100644 index 0000000..8fd4d0d --- /dev/null +++ b/src/lib/json/countries.json @@ -0,0 +1,17 @@ +{ + "us": "United States", + "de": "Germany", + "fr": "France", + "gb": "United Kingdom", + "ar": "Argentina", + "mx": "Mexico", + "jp": "Japan", + "cn": "China", + "in": "India", + "au": "Australia", + "nz": "New Zealand", + "za": "South Africa", + "eg": "Egypt", + "ca": "Canada", + "br": "Brazil" +} diff --git a/src/lib/json/quotes.json b/src/lib/json/quotes.json new file mode 100644 index 0000000..d07424a --- /dev/null +++ b/src/lib/json/quotes.json @@ -0,0 +1,192 @@ +{ + "quotes": [ + { + "quote": "Believe you can and you're halfway there.", + "author": "Theodore Roosevelt" + }, + { + "quote": "The only way to do great work is to love what you do.", + "author": "Steve Jobs" + }, + { + "quote": "In the middle of every difficulty lies opportunity.", + "author": "Albert Einstein" + }, + { + "quote": "The future belongs to those who believe in the beauty of their dreams.", + "author": "Eleanor Roosevelt" + }, + { + "quote": "It does not matter how slowly you go as long as you do not stop.", + "author": "Confucius" + }, + { + "quote": "Success is not final, failure is not fatal: It is the courage to continue that counts.", + "author": "Winston Churchill" + }, + { + "quote": "The only limit to our realization of tomorrow will be our doubts of today.", + "author": "Franklin D. Roosevelt" + }, + { + "quote": "Don't watch the clock; do what it does. Keep going.", + "author": "Sam Levenson" + }, + { + "quote": "You are never too old to set another goal or to dream a new dream.", + "author": "C.S. Lewis" + }, + { + "quote": "The only person you are destined to become is the person you decide to be.", + "author": "Ralph Waldo Emerson" + }, + { + "quote": "Happiness is not something ready-made. It comes from your own actions.", + "author": "Dalai Lama" + }, + { + "quote": "Life is what happens when you're busy making other plans.", + "author": "John Lennon" + }, + { + "quote": "You miss 100% of the shots you don't take.", + "author": "Wayne Gretzky" + }, + { + "quote": "The best time to plant a tree was 20 years ago. The second best time is now.", + "author": "Chinese Proverb" + }, + { + "quote": "The only way to achieve the impossible is to believe it is possible.", + "author": "Charles Kingsleigh" + }, + { + "quote": "Don't count the days, make the days count.", + "author": "Muhammad Ali" + }, + { + "quote": "You don't have to be great to start, but you have to start to be great.", + "author": "Zig Ziglar" + }, + { + "quote": "You can't go back and change the beginning, but you can start where you are and change the ending.", + "author": "C.S. Lewis" + }, + { + "quote": "Dream big and dare to fail.", + "author": "Norman Vaughan" + }, + { + "quote": "The secret of getting ahead is getting started.", + "author": "Mark Twain" + }, + { + "quote": "Everything you can imagine is real.", + "author": "Pablo Picasso" + }, + { + "quote": "You must be the change you wish to see in the world.", + "author": "Mahatma Gandhi" + }, + { + "quote": "If you want to lift yourself up, lift up someone else.", + "author": "Booker T. Washington" + }, + { + "quote": "Believe in yourself and all that you are. Know that there is something inside you that is greater than any obstacle.", + "author": "Christian D. Larson" + }, + { + "quote": "The journey of a thousand miles begins with one step.", + "author": "Lao Tzu" + }, + { + "quote": "Life isn't about waiting for the storm to pass, it's about learning to dance in the rain.", + "author": "Vivian Greene" + }, + { + "quote": "You are never too old to set another goal or to dream a new dream.", + "author": "Les Brown" + }, + { + "quote": "Your time is limited, don't waste it living someone else's life.", + "author": "Steve Jobs" + }, + { + "quote": "Don't let yesterday take up too much of today.", + "author": "Will Rogers" + }, + { + "quote": "The only thing standing between you and your goal is the story you keep telling yourself as to why you can't achieve it.", + "author": "Jordan Belfort" + }, + { + "quote": "The future belongs to those who prepare for it today.", + "author": "Malcolm X" + }, + { + "quote": "The greatest glory in living lies not in never falling, but in rising every time we fall.", + "author": "Nelson Mandela" + }, + { + "quote": "It's not what happens to you, but how you react to it that matters.", + "author": "Epictetus" + }, + { + "quote": "When one door of happiness closes, another opens, but often we look so long at the closed door that we do not see the one that has been opened for us.", + "author": "Helen Keller" + }, + { + "quote": "The only thing that stands between you and your dream is the will to try and the belief that it is actually possible.", + "author": "Joel Brown" + }, + { + "quote": "Success is walking from failure to failure with no loss of enthusiasm.", + "author": "Winston Churchill" + }, + { + "quote": "Believe in yourself! Have faith in your abilities! Without a humble but reasonable confidence in your own powers you cannot be successful or happy.", + "author": "Norman Vincent Peale" + }, + { + "quote": "The greatest adventure is what lies ahead.", + "author": "J.R.R. Tolkien" + }, + { + "quote": "What you get by achieving your goals is not as important as what you become by achieving your goals.", + "author": "Zig Ziglar" + }, + { + "quote": "To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment.", + "author": "Ralph Waldo Emerson" + }, + { + "quote": "What lies behind us and what lies before us are tiny matters compared to what lies within us.", + "author": "Ralph Waldo Emerson" + }, + { + "quote": "The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart.", + "author": "Helen Keller" + }, + { + "quote": "I can't change the direction of the wind, but I can adjust my sails to always reach my destination.", + "author": "Jimmy Dean" + }, + { + "quote": "If you're going through hell, keep going.", + "author": "Winston Churchill" + }, + { + "quote": "Nothing is impossible, the word itself says 'I'm possible'!", + "author": "Audrey Hepburn" + }, + { + "quote": "Keep your face always toward the sunshine - and shadows will fall behind you.", + "author": "Walt Whitman" + }, + { + "quote": "Success is not the key to happiness. Happiness is the key to success. If you love what you are doing, you will be successful.", + "author": "Albert Schweitzer" + } + ] +} diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte index 591ecd1..16956dd 100644 --- a/src/routes/login/+page.svelte +++ b/src/routes/login/+page.svelte @@ -35,7 +35,7 @@
{#if quote != ""} - "{quote}" + {quote} {/if}
diff --git a/src/routes/signup/+page.svelte b/src/routes/signup/+page.svelte index 1dcf0fd..4656c6b 100644 --- a/src/routes/signup/+page.svelte +++ b/src/routes/signup/+page.svelte @@ -47,7 +47,7 @@
{#if quote != ""} - "{quote}" + {quote} {/if}
From 00d9270546b75998ddb39e5316611deea3da8bf6 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Sat, 13 Apr 2024 23:09:52 +0000 Subject: [PATCH 19/20] Update AdventureCard component to include regionId and visited properties --- src/lib/components/AdventureCard.svelte | 20 ++++- src/routes/api/regionvisit/+server.ts | 77 +++++++++++++++++++ .../worldtravel/[countrycode]/+page.server.ts | 14 +++- .../worldtravel/[countrycode]/+page.svelte | 55 ++++++++++++- 4 files changed, 161 insertions(+), 5 deletions(-) create mode 100644 src/routes/api/regionvisit/+server.ts diff --git a/src/lib/components/AdventureCard.svelte b/src/lib/components/AdventureCard.svelte index 534dea0..c88d253 100644 --- a/src/lib/components/AdventureCard.svelte +++ b/src/lib/components/AdventureCard.svelte @@ -10,6 +10,8 @@ export let location: String | undefined = undefined; export let created: String | undefined = undefined; export let id: Number | undefined = undefined; + export let regionId: String | undefined = undefined; + export let visited: Boolean | undefined = undefined; function remove() { dispatch("remove", id); @@ -20,6 +22,14 @@ function add() { dispatch("add", { name, location }); } + function markVisited() { + dispatch("markVisited", regionId); + visited = true; + } + function removeVisit() { + dispatch("removeVisit", regionId); + visited = false; + } {#if type === "mylog"} @@ -110,8 +120,16 @@ >

{name}

+

{regionId}

- + {#if !visited} + + {/if} + {#if visited} + + {/if}
diff --git a/src/routes/api/regionvisit/+server.ts b/src/routes/api/regionvisit/+server.ts new file mode 100644 index 0000000..b28b75a --- /dev/null +++ b/src/routes/api/regionvisit/+server.ts @@ -0,0 +1,77 @@ +import type { RequestEvent } from "@sveltejs/kit"; +import { db } from "$lib/db/db.server"; +import { userVisitedAdventures, userVisitedWorldTravel } from "$lib/db/schema"; +import { and, eq } from "drizzle-orm"; + +export async function POST(event: RequestEvent): Promise { + if (!event.locals.user) { + return new Response(JSON.stringify({ error: "Unauthorized" }), { + status: 401, + headers: { + "Content-Type": "application/json", + }, + }); + } + let body = await event.request.json(); + let res = await db + .insert(userVisitedWorldTravel) + .values({ + userId: event.locals.user.id, + region_id: body.region_id, + }) + .execute(); + return new Response(JSON.stringify({ res: res }), { + status: 200, + headers: { + "Content-Type": "application/json", + }, + }); +} + +export async function GET(event: RequestEvent): Promise { + if (!event.locals.user) { + return new Response(JSON.stringify({ error: "Unauthorized" }), { + status: 401, + headers: { + "Content-Type": "application/json", + }, + }); + } + let res = await db + .select() + .from(userVisitedWorldTravel) + .where(eq(userVisitedWorldTravel.userId,event.locals.user.id)); + return new Response(JSON.stringify({ res: res }), { + status: 200, + headers: { + "Content-Type": "application/json", + }, + }); +} + +export async function DELETE(event: RequestEvent): Promise { + if (!event.locals.user) { + return new Response(JSON.stringify({ error: "Unauthorized" }), { + status: 401, + headers: { + "Content-Type": "application/json", + }, + }); + } + let body = await event.request.json(); + let res = await db + .delete(userVisitedWorldTravel) + .where( + and( + eq(userVisitedWorldTravel.userId, event.locals.user.id), + eq(userVisitedWorldTravel.region_id, body.region_id), + ) + ) + .execute(); + return new Response(JSON.stringify({ res: res }), { + status: 200, + headers: { + "Content-Type": "application/json", + }, + }); +} \ No newline at end of file diff --git a/src/routes/worldtravel/[countrycode]/+page.server.ts b/src/routes/worldtravel/[countrycode]/+page.server.ts index 56828e0..fab7813 100644 --- a/src/routes/worldtravel/[countrycode]/+page.server.ts +++ b/src/routes/worldtravel/[countrycode]/+page.server.ts @@ -1,6 +1,5 @@ -// server laod function import { db } from '$lib/db/db.server.js'; -import { worldTravelCountryRegions } from '$lib/db/schema.js'; +import { userVisitedWorldTravel, worldTravelCountryRegions } from '$lib/db/schema.js'; import { eq } from 'drizzle-orm'; import type { PageServerLoad } from './$types'; @@ -11,8 +10,19 @@ export const load: PageServerLoad = async ({ params, locals }) => { .select() .from(worldTravelCountryRegions) .where(eq(worldTravelCountryRegions.country_code, countrycode)) + + let visitedRegions: { id: number; userId: string; region_id: string; }[] = []; + if (locals.user) { + visitedRegions = await db + .select() + .from(userVisitedWorldTravel) + .where(eq(userVisitedWorldTravel.userId, locals.user.id)) + .execute(); + } + return { regions : data, countrycode: countrycode, + visitedRegions: visitedRegions, }; } \ No newline at end of file diff --git a/src/routes/worldtravel/[countrycode]/+page.svelte b/src/routes/worldtravel/[countrycode]/+page.svelte index dc8e633..22f195a 100644 --- a/src/routes/worldtravel/[countrycode]/+page.svelte +++ b/src/routes/worldtravel/[countrycode]/+page.svelte @@ -3,6 +3,48 @@ import AdventureCard from "$lib/components/AdventureCard.svelte"; import { countryCodeToName } from "$lib"; import { getFlag } from "$lib"; + import { goto } from "$app/navigation"; + import { onMount } from "svelte"; + + function markVisited(event: { detail: string }) { + console.log(`Marked ${event.detail} as visited`); + fetch("/api/regionvisit", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + region_id: event.detail, + }), + }).then((response) => { + if (response.status === 401) { + goto("/login"); + } + return response.json(); + }); + } + + function removeVisit(event: { detail: string }) { + console.log(`Removed visit to ${event.detail}`); + fetch("/api/regionvisit", { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + region_id: event.detail, + }), + }).then((response) => { + if (response.status === 401) { + goto("/login"); + } + return response.json(); + }); + } + + onMount(() => { + console.log(data.visitedRegions); + });

@@ -17,7 +59,16 @@
- {#each data.regions as region} - + {#each data.regions as region (region.id)} + visitedRegion.region_id === region.id, + )} + on:removeVisit={removeVisit} + /> {/each}
From 5e1d7ef160ebfb392eaf2f0063920ab3089a8f4c Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Sat, 13 Apr 2024 23:11:09 +0000 Subject: [PATCH 20/20] Update appVersion to "Web 0.1.5-alpha" in config.ts --- src/lib/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/config.ts b/src/lib/config.ts index 15e14b9..be1264c 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -1,3 +1,3 @@ -export let appVersion = "Web 0.0.1"; +export let appVersion = "Web 0.1.5-alpha"; export let appTitle = "AdventureLog"; export let copyrightYear = "2024" \ No newline at end of file