From b3bd8780e7e15f010270aee73ffc14e27f9bda71 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Sun, 21 Apr 2024 20:26:22 +0000 Subject: [PATCH 01/12] Refactor admin settings page, add UserCard component, and update user management functionality --- package-lock.json | 4 ++-- src/lib/components/UserCard.svelte | 17 +++++++++++++++++ src/routes/settings/admin/+page.server.ts | 18 +++++++++++++----- src/routes/settings/admin/+page.svelte | 14 ++++++++++++++ 4 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 src/lib/components/UserCard.svelte diff --git a/package-lock.json b/package-lock.json index 2e78dd8..baffb49 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "adventurelog", - "version": "0.1.0", + "version": "0.1.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "adventurelog", - "version": "0.1.0", + "version": "0.1.6", "dependencies": { "@lucia-auth/adapter-drizzle": "^1.0.7", "@vercel/analytics": "^1.2.2", diff --git a/src/lib/components/UserCard.svelte b/src/lib/components/UserCard.svelte new file mode 100644 index 0000000..74097f2 --- /dev/null +++ b/src/lib/components/UserCard.svelte @@ -0,0 +1,17 @@ + + +
+
+

{user.first_name} {user.last_name}

+

{user.username}

+

Last Login: {user.last_login}

+

Created: {user.signup_date}

+
+ +
+
+
diff --git a/src/routes/settings/admin/+page.server.ts b/src/routes/settings/admin/+page.server.ts index 888ea6e..ca0bda1 100644 --- a/src/routes/settings/admin/+page.server.ts +++ b/src/routes/settings/admin/+page.server.ts @@ -1,16 +1,24 @@ import { error, redirect, type Actions, type Handle } from "@sveltejs/kit"; import type { PageServerLoad } from "./$types"; import { db } from "$lib/db/db.server"; -import { sessionTable } from "$lib/db/schema"; +import { sessionTable, userTable } from "$lib/db/schema"; +import type { DatabaseUser } from "$lib/server/auth"; export const load: PageServerLoad = async (event) => { + let users: DatabaseUser[] = []; if (!event.locals.user) { return redirect(302, "/login"); - } else { - if (event.locals.user.role !== "admin") { - return redirect(302, "/settings"); - } } + if (event.locals.user.role !== "admin") { + return redirect(302, "/settings"); + } + if (event.locals.user.role === "admin") { + users = (await db.select().from(userTable).execute()) as DatabaseUser[]; + console.log(users); + } + return { + users, + }; }; export const actions: Actions = { diff --git a/src/routes/settings/admin/+page.svelte b/src/routes/settings/admin/+page.svelte index d79147d..189f49b 100644 --- a/src/routes/settings/admin/+page.svelte +++ b/src/routes/settings/admin/+page.svelte @@ -1,13 +1,18 @@ + + + + + + diff --git a/src/lib/components/UserCard.svelte b/src/lib/components/UserCard.svelte index 74097f2..b4ef1fd 100644 --- a/src/lib/components/UserCard.svelte +++ b/src/lib/components/UserCard.svelte @@ -4,12 +4,14 @@ export let user: DatabaseUser; -
+

{user.first_name} {user.last_name}

-

{user.username}

+

{user.username} - {user.icon}

Last Login: {user.last_login}

Created: {user.signup_date}

+

{user.role}

+

{user.id}

diff --git a/src/routes/settings/admin/+page.server.ts b/src/routes/settings/admin/+page.server.ts index ca0bda1..001ef8b 100644 --- a/src/routes/settings/admin/+page.server.ts +++ b/src/routes/settings/admin/+page.server.ts @@ -14,7 +14,6 @@ export const load: PageServerLoad = async (event) => { } if (event.locals.user.role === "admin") { users = (await db.select().from(userTable).execute()) as DatabaseUser[]; - console.log(users); } return { users, @@ -28,7 +27,7 @@ export const actions: Actions = { message: "You are not authorized to perform this action", }); } else { - console.log("ALL SESSIONS CLEARED"); + console.log("ALL SESSIONS CLEARED by " + event.locals.user?.username); await db.delete(sessionTable).execute(); return { status: 200, diff --git a/src/routes/settings/admin/+page.svelte b/src/routes/settings/admin/+page.svelte index 189f49b..7a585c4 100644 --- a/src/routes/settings/admin/+page.svelte +++ b/src/routes/settings/admin/+page.svelte @@ -12,6 +12,27 @@ let first_name: string = ""; let last_name: string = ""; let password: string = ""; + import ConfirmModal from "$lib/components/ConfirmModal.svelte"; + + let isModalOpen = false; + + async function clearAllSessions() { + await fetch("?/clearAllSessions", { + method: "POST", + headers: { + "Content-Type": "application/x-www-form-urlencoded", + }, + body: new URLSearchParams(), + }); + window.location.reload(); + } + + function openModal() { + isModalOpen = true; + } + function closeModal() { + isModalOpen = false; + } const addUser: SubmitFunction = async ({ formData, action, cancel }) => { const response = await fetch(action, { @@ -95,22 +116,30 @@
{/if} -

Session Managment

+

Session Managment

-
- -
+

User Managment

-
+
{#each $page.data.users as user}
{/each}
+ +{#if isModalOpen} + +{/if} From b2184bdee3f6f35a48b9ed7cdc4275a491d09a04 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Sun, 21 Apr 2024 22:42:49 +0000 Subject: [PATCH 03/12] Refactor database schema and add planner functionality --- migrations/0004_noisy_squadron_supreme.sql | 13 + migrations/0005_massive_black_tarantula.sql | 1 + migrations/0006_colorful_inertia.sql | 10 + migrations/meta/0004_snapshot.json | 463 ++++++++++++++++++++ migrations/meta/0005_snapshot.json | 463 ++++++++++++++++++++ migrations/meta/0006_snapshot.json | 463 ++++++++++++++++++++ migrations/meta/_journal.json | 21 + src/lib/components/AdventureCard.svelte | 23 + src/lib/components/Navbar.svelte | 4 + src/lib/db/schema.ts | 12 +- src/lib/utils/types.ts | 12 +- src/routes/log/+page.svelte | 8 +- src/routes/planner/+page.server.ts | 21 + src/routes/planner/+page.svelte | 29 ++ src/routes/settings/admin/+page.server.ts | 26 +- src/routes/settings/admin/+page.svelte | 36 +- src/routes/worldtravel/+page.svelte | 2 +- 17 files changed, 1593 insertions(+), 14 deletions(-) create mode 100644 migrations/0004_noisy_squadron_supreme.sql create mode 100644 migrations/0005_massive_black_tarantula.sql create mode 100644 migrations/0006_colorful_inertia.sql create mode 100644 migrations/meta/0004_snapshot.json create mode 100644 migrations/meta/0005_snapshot.json create mode 100644 migrations/meta/0006_snapshot.json create mode 100644 src/routes/planner/+page.server.ts create mode 100644 src/routes/planner/+page.svelte diff --git a/migrations/0004_noisy_squadron_supreme.sql b/migrations/0004_noisy_squadron_supreme.sql new file mode 100644 index 0000000..73b4715 --- /dev/null +++ b/migrations/0004_noisy_squadron_supreme.sql @@ -0,0 +1,13 @@ +CREATE TABLE IF NOT EXISTS "userPlannedAdventures" ( + "id" serial PRIMARY KEY NOT NULL, + "user_id" text NOT NULL, + "adventure_name" text NOT NULL, + "location" text, + "activity_types" text +); +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "userPlannedAdventures" ADD CONSTRAINT "userPlannedAdventures_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_massive_black_tarantula.sql b/migrations/0005_massive_black_tarantula.sql new file mode 100644 index 0000000..8bd5e95 --- /dev/null +++ b/migrations/0005_massive_black_tarantula.sql @@ -0,0 +1 @@ +ALTER TABLE "userPlannedAdventures" ALTER COLUMN "activity_types" SET DATA TYPE json; \ No newline at end of file diff --git a/migrations/0006_colorful_inertia.sql b/migrations/0006_colorful_inertia.sql new file mode 100644 index 0000000..dab5474 --- /dev/null +++ b/migrations/0006_colorful_inertia.sql @@ -0,0 +1,10 @@ +ALTER TABLE "userPlannedAdventures" RENAME COLUMN "user_id" TO "userId";--> statement-breakpoint +ALTER TABLE "userPlannedAdventures" RENAME COLUMN "adventure_name" TO "adventureName";--> statement-breakpoint +ALTER TABLE "userPlannedAdventures" RENAME COLUMN "activity_types" TO "activityTypes";--> statement-breakpoint +ALTER TABLE "userPlannedAdventures" DROP CONSTRAINT "userPlannedAdventures_user_id_user_id_fk"; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "userPlannedAdventures" ADD CONSTRAINT "userPlannedAdventures_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/migrations/meta/0004_snapshot.json b/migrations/meta/0004_snapshot.json new file mode 100644 index 0000000..a3cad2e --- /dev/null +++ b/migrations/meta/0004_snapshot.json @@ -0,0 +1,463 @@ +{ + "id": "4ed4f0d5-7731-49a1-ab2f-9af3aad2c95c", + "prevId": "72cc9a9a-a12e-4ca2-b644-b704673af4d7", + "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": {} + }, + "userPlannedAdventures": { + "name": "userPlannedAdventures", + "schema": "", + "columns": { + "id": { + "name": "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 + }, + "activity_types": { + "name": "activity_types", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userPlannedAdventures_user_id_user_id_fk": { + "name": "userPlannedAdventures_user_id_user_id_fk", + "tableFrom": "userPlannedAdventures", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "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 + }, + "signup_date": { + "name": "signup_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_login": { + "name": "last_login", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "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": {} + }, + "userVisitedWorldTravel": { + "name": "userVisitedWorldTravel", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "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_country_code_worldTravelCountries_country_code_fk": { + "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", + "tableFrom": "userVisitedWorldTravel", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_code" + ], + "columnsTo": [ + "country_code" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "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": "", + "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 + }, + "info": { + "name": "info", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "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/0005_snapshot.json b/migrations/meta/0005_snapshot.json new file mode 100644 index 0000000..8b41890 --- /dev/null +++ b/migrations/meta/0005_snapshot.json @@ -0,0 +1,463 @@ +{ + "id": "f3c33262-0fe7-4b0f-8522-82e337da26d5", + "prevId": "4ed4f0d5-7731-49a1-ab2f-9af3aad2c95c", + "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": {} + }, + "userPlannedAdventures": { + "name": "userPlannedAdventures", + "schema": "", + "columns": { + "id": { + "name": "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 + }, + "activity_types": { + "name": "activity_types", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userPlannedAdventures_user_id_user_id_fk": { + "name": "userPlannedAdventures_user_id_user_id_fk", + "tableFrom": "userPlannedAdventures", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "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 + }, + "signup_date": { + "name": "signup_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_login": { + "name": "last_login", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "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": {} + }, + "userVisitedWorldTravel": { + "name": "userVisitedWorldTravel", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "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_country_code_worldTravelCountries_country_code_fk": { + "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", + "tableFrom": "userVisitedWorldTravel", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_code" + ], + "columnsTo": [ + "country_code" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "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": "", + "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 + }, + "info": { + "name": "info", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "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/0006_snapshot.json b/migrations/meta/0006_snapshot.json new file mode 100644 index 0000000..b5672e8 --- /dev/null +++ b/migrations/meta/0006_snapshot.json @@ -0,0 +1,463 @@ +{ + "id": "42010132-1400-4431-800b-7ecd45c7aa9a", + "prevId": "f3c33262-0fe7-4b0f-8522-82e337da26d5", + "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": {} + }, + "userPlannedAdventures": { + "name": "userPlannedAdventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventureName": { + "name": "adventureName", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activityTypes": { + "name": "activityTypes", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userPlannedAdventures_userId_user_id_fk": { + "name": "userPlannedAdventures_userId_user_id_fk", + "tableFrom": "userPlannedAdventures", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "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 + }, + "signup_date": { + "name": "signup_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_login": { + "name": "last_login", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "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": {} + }, + "userVisitedWorldTravel": { + "name": "userVisitedWorldTravel", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "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_country_code_worldTravelCountries_country_code_fk": { + "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", + "tableFrom": "userVisitedWorldTravel", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_code" + ], + "columnsTo": [ + "country_code" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "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": "", + "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 + }, + "info": { + "name": "info", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "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 a1f987e..c185a1f 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -29,6 +29,27 @@ "when": 1713402092365, "tag": "0003_easy_iron_monger", "breakpoints": true + }, + { + "idx": 4, + "version": "5", + "when": 1713737819317, + "tag": "0004_noisy_squadron_supreme", + "breakpoints": true + }, + { + "idx": 5, + "version": "5", + "when": 1713738940329, + "tag": "0005_massive_black_tarantula", + "breakpoints": true + }, + { + "idx": 6, + "version": "5", + "when": 1713739045755, + "tag": "0006_colorful_inertia", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/lib/components/AdventureCard.svelte b/src/lib/components/AdventureCard.svelte index 79684f2..6548f3b 100644 --- a/src/lib/components/AdventureCard.svelte +++ b/src/lib/components/AdventureCard.svelte @@ -14,6 +14,7 @@ export let regionId: String | undefined = undefined; export let visited: Boolean | undefined = undefined; export let countryCode: String | undefined = undefined; + export let activityTypes: String[] | undefined = undefined; function remove() { dispatch("remove", id); @@ -126,3 +127,25 @@
{/if} + +{#if type === "planner"} +
+
+

{name}

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

{location}

+
+ {/if} + {#if activityTypes && activityTypes.length > 0} +

{activityTypes}

+ {/if} +
+ +
+
+
+{/if} diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index 48997b2..3f799de 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -78,6 +78,10 @@ + {/if} diff --git a/src/lib/components/DeleteConfirmation.svelte b/src/lib/components/DeleteConfirmation.svelte index 96d5b85..e227f74 100644 --- a/src/lib/components/DeleteConfirmation.svelte +++ b/src/lib/components/DeleteConfirmation.svelte @@ -51,10 +51,10 @@ />
- +
diff --git a/src/lib/components/EditModal.svelte b/src/lib/components/EditModal.svelte index 59a813b..baecd7b 100644 --- a/src/lib/components/EditModal.svelte +++ b/src/lib/components/EditModal.svelte @@ -2,7 +2,7 @@ export let editId: number = NaN; export let editName: string = ""; export let editLocation: string = ""; - export let editCreated: string = ""; + export let editdate: string = ""; import { createEventDispatcher } from "svelte"; import type { Adventure } from "$lib/utils/types"; const dispatch = createEventDispatcher(); @@ -23,7 +23,7 @@ id: editId, name: editName, location: editLocation, - created: editCreated, + date: editdate, }; dispatch("submit", adventureEdited); console.log(adventureEdited); @@ -70,11 +70,11 @@ />
- +
diff --git a/src/lib/components/UserCard.svelte b/src/lib/components/UserCard.svelte index b4ef1fd..64ee94b 100644 --- a/src/lib/components/UserCard.svelte +++ b/src/lib/components/UserCard.svelte @@ -9,7 +9,7 @@

{user.first_name} {user.last_name}

{user.username} - {user.icon}

Last Login: {user.last_login}

-

Created: {user.signup_date}

+

date: {user.signup_date}

{user.role}

{user.id}

diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index e6ae0f9..4d77090 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -1,3 +1,4 @@ +import { desc } from "drizzle-orm"; import { pgTable, text, @@ -99,4 +100,6 @@ export const userPlannedAdventures = pgTable("userPlannedAdventures", { name: text("adventureName").notNull(), location: text("location"), activityTypes: json("activityTypes"), + description: text("description"), + date: text("plannedDate"), }); diff --git a/src/lib/utils/types.ts b/src/lib/utils/types.ts index 6ef1cfa..824a53c 100644 --- a/src/lib/utils/types.ts +++ b/src/lib/utils/types.ts @@ -2,7 +2,7 @@ export interface Adventure { id?: number; name?: string; location?: string | undefined; - created?: string | undefined; + date?: string | undefined; description?: string | undefined; activityTypes?: string[] | undefined; } diff --git a/src/routes/api/visits/+server.ts b/src/routes/api/visits/+server.ts index 72db320..777106d 100644 --- a/src/routes/api/visits/+server.ts +++ b/src/routes/api/visits/+server.ts @@ -26,7 +26,7 @@ export async function GET(event: RequestEvent): Promise { id: item.adventureID, name: item.adventureName, location: item.location, - created: item.visitedDate, + date: item.visitedDate, })), }), { @@ -91,7 +91,7 @@ export async function POST(event: RequestEvent): Promise { } // get properties from the body - const { name, location, created } = await event.request.json(); + const { name, location, date } = await event.request.json(); // insert the adventure to the user's visited list await db @@ -100,10 +100,10 @@ export async function POST(event: RequestEvent): Promise { userId: event.locals.user.id, adventureName: name, location: location, - visitedDate: created, + visitedDate: date, }) .execute(); -let res = await db + let res = await db .select() .from(userVisitedAdventures) .where( @@ -111,17 +111,17 @@ let res = await db eq(userVisitedAdventures.userId, event.locals.user.id), eq(userVisitedAdventures.adventureName, name), eq(userVisitedAdventures.location, location), - eq(userVisitedAdventures.visitedDate, created) + eq(userVisitedAdventures.visitedDate, date) ) ) .execute(); -// return a response with the adventure object values + // return a response with the adventure object values return new Response( JSON.stringify({ - adventure: { name, location, created }, + adventure: { name, location, date }, message: { message: "Adventure added" }, - id: res[0].adventureID + id: res[0].adventureID, }), { status: 200, @@ -144,7 +144,7 @@ export async function PUT(event: RequestEvent): Promise { } // get properties from the body - const { id, name, location, created } = await event.request.json(); + const { id, name, location, date } = await event.request.json(); // update the adventure in the user's visited list await db @@ -152,7 +152,7 @@ export async function PUT(event: RequestEvent): Promise { .set({ adventureName: name, location: location, - visitedDate: created, + visitedDate: date, }) .where( and( @@ -164,7 +164,7 @@ export async function PUT(event: RequestEvent): Promise { return new Response( JSON.stringify({ - adventure: { id, name, location, created }, + adventure: { id, name, location, date }, message: { message: "Adventure updated" }, }), { @@ -174,4 +174,4 @@ export async function PUT(event: RequestEvent): Promise { }, } ); -} \ No newline at end of file +} diff --git a/src/routes/featured/+page.svelte b/src/routes/featured/+page.svelte index a755ee0..dd22129 100644 --- a/src/routes/featured/+page.svelte +++ b/src/routes/featured/+page.svelte @@ -19,7 +19,7 @@ body: JSON.stringify({ name: event.detail.name, location: event.detail.location, - created: "", + date: "", }), }); @@ -46,7 +46,7 @@ on:add={add} name={adventure.name} location={adventure.location} - created="" + date="" id={NaN} /> {/each} diff --git a/src/routes/log/+page.svelte b/src/routes/log/+page.svelte index 26bbac5..30f786f 100644 --- a/src/routes/log/+page.svelte +++ b/src/routes/log/+page.svelte @@ -20,7 +20,7 @@ let editId: number = NaN; let editName: string = ""; let editLocation: string = ""; - let editCreated: string = ""; + let editdate: string = ""; let isShowingToast: boolean = false; let toastAction: string = ""; @@ -71,7 +71,7 @@ body: JSON.stringify({ name: newName, location: newLocation, - created: dateString, + date: dateString, }), }) .then((response) => response.json()) @@ -84,7 +84,7 @@ id: newId, name: newName, location: newLocation, - created: dateString, + date: dateString, }, ]; newName = ""; // Reset newName and newLocation after adding adventure @@ -109,7 +109,7 @@ id: event.detail.id, name: event.detail.name, location: event.detail.location, - created: event.detail.created, + date: event.detail.date, }), }) .then((response) => response.json()) @@ -122,7 +122,7 @@ editId = NaN; editName = ""; editLocation = ""; - editCreated = ""; + editdate = ""; showToast("Adventure edited successfully!"); }) .catch((error) => { @@ -138,7 +138,7 @@ editId = adventure.id || 0; editName = adventure.name || ""; editLocation = adventure.location || ""; - editCreated = adventure.created || ""; + editdate = adventure.date || ""; } } @@ -168,7 +168,7 @@ editId = NaN; editName = ""; editLocation = ""; - editCreated = ""; + editdate = ""; } function deleteData() { @@ -263,7 +263,7 @@ bind:editId bind:editName bind:editLocation - bind:editCreated + bind:editdate on:submit={saveAdventure} on:close={handleClose} /> @@ -278,7 +278,7 @@ id={adventure.id} name={adventure.name} location={adventure.location} - created={adventure.created} + date={adventure.date} on:edit={editAdventure} on:remove={removeAdventure} /> diff --git a/src/routes/planner/+page.svelte b/src/routes/planner/+page.svelte index 919a4bd..2d00005 100644 --- a/src/routes/planner/+page.svelte +++ b/src/routes/planner/+page.svelte @@ -24,6 +24,8 @@ name={adventure.name} location={adventure.location} activityTypes={adventure.activityTypes} + description={adventure?.description} + date={adventure?.date} /> {/each}
diff --git a/src/routes/shared/[key]/+page.server.ts b/src/routes/shared/[key]/+page.server.ts index 92f7d08..0d2eeee 100644 --- a/src/routes/shared/[key]/+page.server.ts +++ b/src/routes/shared/[key]/+page.server.ts @@ -25,14 +25,13 @@ export async function load({ params }) { id: item.id, name: item.name, location: item.location, - created: item.created, + date: item.date, } as Adventure; }); let name = rawData.name; let date = rawData.date; - // Return the array of Adventure objects return { adventureArray, diff --git a/src/routes/shared/[key]/+page.svelte b/src/routes/shared/[key]/+page.svelte index 78e591c..7fcff7a 100644 --- a/src/routes/shared/[key]/+page.svelte +++ b/src/routes/shared/[key]/+page.svelte @@ -10,7 +10,7 @@

{adventure.name}

{adventure.location}

-

{adventure.created}

+

{adventure.date}

{adventure.id}

{/each} --> @@ -25,7 +25,7 @@ id={adventure.id} name={adventure.name} location={adventure.location} - created={adventure.created} + date={adventure.date} /> {/each} diff --git a/src/routes/signup/+page.server.ts b/src/routes/signup/+page.server.ts index e287775..0256749 100644 --- a/src/routes/signup/+page.server.ts +++ b/src/routes/signup/+page.server.ts @@ -129,7 +129,7 @@ export const actions: Actions = { "content-type": "application/json", }, body: JSON.stringify({ - message: "User created", + message: "User date", }), }; } From 921d36aa70e12e6764eb794df9465ce226963616 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Mon, 22 Apr 2024 00:56:43 +0000 Subject: [PATCH 05/12] Add new migrations and update Adventure interface --- migrations/0008_open_forgotten_one.sql | 18 + migrations/0009_clammy_meteorite.sql | 1 + migrations/0010_dazzling_morbius.sql | 1 + migrations/0011_bizarre_silver_samurai.sql | 1 + migrations/meta/0008_snapshot.json | 559 +++++++++++++++++++++ migrations/meta/0009_snapshot.json | 559 +++++++++++++++++++++ migrations/meta/0010_snapshot.json | 559 +++++++++++++++++++++ migrations/meta/0011_snapshot.json | 559 +++++++++++++++++++++ migrations/meta/_journal.json | 28 ++ sql/parks.sql | 30 +- src/lib/db/schema.ts | 16 + src/lib/utils/types.ts | 47 +- src/routes/setup/+page.svelte | 2 +- 13 files changed, 2326 insertions(+), 54 deletions(-) create mode 100644 migrations/0008_open_forgotten_one.sql create mode 100644 migrations/0009_clammy_meteorite.sql create mode 100644 migrations/0010_dazzling_morbius.sql create mode 100644 migrations/0011_bizarre_silver_samurai.sql create mode 100644 migrations/meta/0008_snapshot.json create mode 100644 migrations/meta/0009_snapshot.json create mode 100644 migrations/meta/0010_snapshot.json create mode 100644 migrations/meta/0011_snapshot.json diff --git a/migrations/0008_open_forgotten_one.sql b/migrations/0008_open_forgotten_one.sql new file mode 100644 index 0000000..8d020da --- /dev/null +++ b/migrations/0008_open_forgotten_one.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS "adventures" ( + "id" serial PRIMARY KEY NOT NULL, + "userId" text NOT NULL, + "adventureName" text NOT NULL, + "location" text, + "activityTypes" json, + "description" text, + "rating" integer, + "link" text, + "imageUrl" text, + "date" text +); +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "adventures" ADD CONSTRAINT "adventures_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/migrations/0009_clammy_meteorite.sql b/migrations/0009_clammy_meteorite.sql new file mode 100644 index 0000000..9ba6b21 --- /dev/null +++ b/migrations/0009_clammy_meteorite.sql @@ -0,0 +1 @@ +ALTER TABLE "adventures" RENAME COLUMN "adventureName" TO "name"; \ No newline at end of file diff --git a/migrations/0010_dazzling_morbius.sql b/migrations/0010_dazzling_morbius.sql new file mode 100644 index 0000000..e49b9b0 --- /dev/null +++ b/migrations/0010_dazzling_morbius.sql @@ -0,0 +1 @@ +ALTER TABLE "userPlannedAdventures" ALTER COLUMN "userId" DROP NOT NULL; \ No newline at end of file diff --git a/migrations/0011_bizarre_silver_samurai.sql b/migrations/0011_bizarre_silver_samurai.sql new file mode 100644 index 0000000..313722a --- /dev/null +++ b/migrations/0011_bizarre_silver_samurai.sql @@ -0,0 +1 @@ +ALTER TABLE "userPlannedAdventures" ALTER COLUMN "userId" SET NOT NULL; \ No newline at end of file diff --git a/migrations/meta/0008_snapshot.json b/migrations/meta/0008_snapshot.json new file mode 100644 index 0000000..3b1af89 --- /dev/null +++ b/migrations/meta/0008_snapshot.json @@ -0,0 +1,559 @@ +{ + "id": "4ef5cc7c-16cb-44d1-8a35-9989fbae87b2", + "prevId": "2dd5d59b-9e77-4a7a-9287-65e6b2456eab", + "version": "5", + "dialect": "pg", + "tables": { + "adventures": { + "name": "adventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventureName": { + "name": "adventureName", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activityTypes": { + "name": "activityTypes", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "imageUrl": { + "name": "imageUrl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "adventures_userId_user_id_fk": { + "name": "adventures_userId_user_id_fk", + "tableFrom": "adventures", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "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": {} + }, + "userPlannedAdventures": { + "name": "userPlannedAdventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventureName": { + "name": "adventureName", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activityTypes": { + "name": "activityTypes", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plannedDate": { + "name": "plannedDate", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userPlannedAdventures_userId_user_id_fk": { + "name": "userPlannedAdventures_userId_user_id_fk", + "tableFrom": "userPlannedAdventures", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "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 + }, + "signup_date": { + "name": "signup_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_login": { + "name": "last_login", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "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": {} + }, + "userVisitedWorldTravel": { + "name": "userVisitedWorldTravel", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "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_country_code_worldTravelCountries_country_code_fk": { + "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", + "tableFrom": "userVisitedWorldTravel", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_code" + ], + "columnsTo": [ + "country_code" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "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": "", + "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 + }, + "info": { + "name": "info", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "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/0009_snapshot.json b/migrations/meta/0009_snapshot.json new file mode 100644 index 0000000..2b780c0 --- /dev/null +++ b/migrations/meta/0009_snapshot.json @@ -0,0 +1,559 @@ +{ + "id": "e79b9053-4a84-4d6f-b6ac-b28a12a2edb8", + "prevId": "4ef5cc7c-16cb-44d1-8a35-9989fbae87b2", + "version": "5", + "dialect": "pg", + "tables": { + "adventures": { + "name": "adventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activityTypes": { + "name": "activityTypes", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "imageUrl": { + "name": "imageUrl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "adventures_userId_user_id_fk": { + "name": "adventures_userId_user_id_fk", + "tableFrom": "adventures", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "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": {} + }, + "userPlannedAdventures": { + "name": "userPlannedAdventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventureName": { + "name": "adventureName", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activityTypes": { + "name": "activityTypes", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plannedDate": { + "name": "plannedDate", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userPlannedAdventures_userId_user_id_fk": { + "name": "userPlannedAdventures_userId_user_id_fk", + "tableFrom": "userPlannedAdventures", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "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 + }, + "signup_date": { + "name": "signup_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_login": { + "name": "last_login", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "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": {} + }, + "userVisitedWorldTravel": { + "name": "userVisitedWorldTravel", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "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_country_code_worldTravelCountries_country_code_fk": { + "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", + "tableFrom": "userVisitedWorldTravel", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_code" + ], + "columnsTo": [ + "country_code" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "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": "", + "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 + }, + "info": { + "name": "info", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "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 new file mode 100644 index 0000000..c63b3cc --- /dev/null +++ b/migrations/meta/0010_snapshot.json @@ -0,0 +1,559 @@ +{ + "id": "a826933a-d744-4ac7-8858-43be4f4fd078", + "prevId": "e79b9053-4a84-4d6f-b6ac-b28a12a2edb8", + "version": "5", + "dialect": "pg", + "tables": { + "adventures": { + "name": "adventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activityTypes": { + "name": "activityTypes", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "imageUrl": { + "name": "imageUrl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "adventures_userId_user_id_fk": { + "name": "adventures_userId_user_id_fk", + "tableFrom": "adventures", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "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": {} + }, + "userPlannedAdventures": { + "name": "userPlannedAdventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "adventureName": { + "name": "adventureName", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activityTypes": { + "name": "activityTypes", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plannedDate": { + "name": "plannedDate", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userPlannedAdventures_userId_user_id_fk": { + "name": "userPlannedAdventures_userId_user_id_fk", + "tableFrom": "userPlannedAdventures", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "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 + }, + "signup_date": { + "name": "signup_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_login": { + "name": "last_login", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "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": {} + }, + "userVisitedWorldTravel": { + "name": "userVisitedWorldTravel", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "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_country_code_worldTravelCountries_country_code_fk": { + "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", + "tableFrom": "userVisitedWorldTravel", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_code" + ], + "columnsTo": [ + "country_code" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "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": "", + "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 + }, + "info": { + "name": "info", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "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..3d17ff8 --- /dev/null +++ b/migrations/meta/0011_snapshot.json @@ -0,0 +1,559 @@ +{ + "id": "d1a58675-3daf-43e2-a9a1-c56767fc3d0e", + "prevId": "a826933a-d744-4ac7-8858-43be4f4fd078", + "version": "5", + "dialect": "pg", + "tables": { + "adventures": { + "name": "adventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activityTypes": { + "name": "activityTypes", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "imageUrl": { + "name": "imageUrl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "adventures_userId_user_id_fk": { + "name": "adventures_userId_user_id_fk", + "tableFrom": "adventures", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "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": {} + }, + "userPlannedAdventures": { + "name": "userPlannedAdventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventureName": { + "name": "adventureName", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activityTypes": { + "name": "activityTypes", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plannedDate": { + "name": "plannedDate", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userPlannedAdventures_userId_user_id_fk": { + "name": "userPlannedAdventures_userId_user_id_fk", + "tableFrom": "userPlannedAdventures", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "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 + }, + "signup_date": { + "name": "signup_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_login": { + "name": "last_login", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "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": {} + }, + "userVisitedWorldTravel": { + "name": "userVisitedWorldTravel", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "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_country_code_worldTravelCountries_country_code_fk": { + "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", + "tableFrom": "userVisitedWorldTravel", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_code" + ], + "columnsTo": [ + "country_code" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "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": "", + "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 + }, + "info": { + "name": "info", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "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 e2109e8..cbf0339 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -57,6 +57,34 @@ "when": 1713739446962, "tag": "0007_clear_sinister_six", "breakpoints": true + }, + { + "idx": 8, + "version": "5", + "when": 1713746555380, + "tag": "0008_open_forgotten_one", + "breakpoints": true + }, + { + "idx": 9, + "version": "5", + "when": 1713746620778, + "tag": "0009_clammy_meteorite", + "breakpoints": true + }, + { + "idx": 10, + "version": "5", + "when": 1713746685965, + "tag": "0010_dazzling_morbius", + "breakpoints": true + }, + { + "idx": 11, + "version": "5", + "when": 1713746739294, + "tag": "0011_bizarre_silver_samurai", + "breakpoints": true } ] } \ No newline at end of file diff --git a/sql/parks.sql b/sql/parks.sql index b8697f4..0afcd4e 100644 --- a/sql/parks.sql +++ b/sql/parks.sql @@ -1,15 +1,15 @@ -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 +-- INSERT INTO "adventures" (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/src/lib/db/schema.ts b/src/lib/db/schema.ts index 4d77090..99fc714 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -103,3 +103,19 @@ export const userPlannedAdventures = pgTable("userPlannedAdventures", { description: text("description"), date: text("plannedDate"), }); + +export const adventureTable = pgTable("adventures", { + id: serial("id").primaryKey(), + type: text("type").notNull(), + userId: text("userId") + .notNull() + .references(() => userTable.id), + name: text("name").notNull(), + location: text("location"), + activityTypes: json("activityTypes"), + description: text("description"), + rating: integer("rating"), + link: text("link"), + imageUrl: text("imageUrl"), + date: text("date"), +}); diff --git a/src/lib/utils/types.ts b/src/lib/utils/types.ts index 824a53c..831c609 100644 --- a/src/lib/utils/types.ts +++ b/src/lib/utils/types.ts @@ -1,41 +1,12 @@ export interface Adventure { - id?: number; - name?: string; - location?: string | undefined; - date?: string | undefined; - description?: string | undefined; - activityTypes?: string[] | undefined; -} - -export interface RegionInfo { + id: number; + type: string; name: string; - abbreviation: string; - description: string; - capital: string; - largest_city: string; - area: { - total: number; - units: string; - }; - population: { - estimate: number; - year: number; - }; - state_flower: string; - state_bird: string; - state_tree: string; - climate: { - description: string; - summer_highs: string; - winter_lows: string; - precipitation: string; - }; - economy: { - industries: string[]; - agricultural_products: string[]; - }; - tourism: { - attractions: string[]; - }; - major_sports_teams: string[]; + location?: string | undefined; + activityTypes?: string[] | undefined; + description?: string | undefined; + rating?: number | undefined; + link?: string | undefined; + imageUrl?: string | undefined; + date?: string | undefined; } diff --git a/src/routes/setup/+page.svelte b/src/routes/setup/+page.svelte index 5fc47db..b0d5be5 100644 --- a/src/routes/setup/+page.svelte +++ b/src/routes/setup/+page.svelte @@ -39,7 +39,7 @@ id="password" class="block mb-2 input input-bordered w-full max-w-xs" />
- + From e197de9d395325466c82a53927cefce72e00affd Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 26 Apr 2024 00:23:30 +0000 Subject: [PATCH 06/12] Add WorldTravelCard component --- src/lib/components/WorldTravelCard.svelte | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/lib/components/WorldTravelCard.svelte diff --git a/src/lib/components/WorldTravelCard.svelte b/src/lib/components/WorldTravelCard.svelte new file mode 100644 index 0000000..99acd6b --- /dev/null +++ b/src/lib/components/WorldTravelCard.svelte @@ -0,0 +1,42 @@ + + +
+
+

{name}

+

{regionId}

+
+ + {#if !visited} + + {/if} + {#if visited} + + {/if} +
+
+
From 37f050d254554fbe991344850301a23d11054179 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 26 Apr 2024 01:14:13 +0000 Subject: [PATCH 07/12] Started Migration --- src/lib/components/AdventureCard.svelte | 6 +-- src/routes/api/visits/+server.ts | 60 ++++++++++++------------- src/routes/log/+page.svelte | 30 +++++++++---- src/services/adventureService.ts | 39 ---------------- 4 files changed, 54 insertions(+), 81 deletions(-) diff --git a/src/lib/components/AdventureCard.svelte b/src/lib/components/AdventureCard.svelte index d52eb83..1b2180f 100644 --- a/src/lib/components/AdventureCard.svelte +++ b/src/lib/components/AdventureCard.svelte @@ -53,7 +53,7 @@

{location}

{/if} - {#if date !== ""} + {#if date && date !== ""}

{date}

@@ -73,7 +73,7 @@ >

{name}

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

{location}

@@ -92,7 +92,7 @@ >

{name}

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

{location}

diff --git a/src/routes/api/visits/+server.ts b/src/routes/api/visits/+server.ts index 777106d..bf575de 100644 --- a/src/routes/api/visits/+server.ts +++ b/src/routes/api/visits/+server.ts @@ -1,6 +1,6 @@ import { lucia } from "$lib/server/auth"; import type { RequestEvent } from "@sveltejs/kit"; -import { userVisitedAdventures } from "$lib/db/schema"; +import { adventureTable, userVisitedAdventures } from "$lib/db/schema"; import { db } from "$lib/db/db.server"; import { and, eq } from "drizzle-orm"; import type { Adventure } from "$lib/utils/types"; @@ -17,18 +17,12 @@ export async function GET(event: RequestEvent): Promise { } let result = await db .select() - .from(userVisitedAdventures) - .where(eq(userVisitedAdventures.userId, event.locals.user.id)) + .from(adventureTable) + .where(eq(adventureTable.userId, event.locals.user.id)) .execute(); return new Response( - JSON.stringify({ - adventures: result.map((item) => ({ - id: item.adventureID, - name: item.adventureName, - location: item.location, - date: item.visitedDate, - })), - }), + // turn the result into an Adventure object array + JSON.stringify(result.map((r) => r as Adventure)), { status: 200, headers: { @@ -62,11 +56,11 @@ export async function DELETE(event: RequestEvent): Promise { } let res = await db - .delete(userVisitedAdventures) + .delete(adventureTable) .where( and( - eq(userVisitedAdventures.userId, event.locals.user.id), - eq(userVisitedAdventures.adventureID, Number(id)) + eq(adventureTable.userId, event.locals.user.id), + eq(adventureTable.id, Number(id)) ) ) .execute(); @@ -90,28 +84,30 @@ export async function POST(event: RequestEvent): Promise { }); } - // get properties from the body - const { name, location, date } = await event.request.json(); + const { newAdventure } = await event.request.json(); + console.log(newAdventure); + const { name, location, date } = newAdventure; // insert the adventure to the user's visited list await db - .insert(userVisitedAdventures) + .insert(adventureTable) .values({ userId: event.locals.user.id, - adventureName: name, + type: "mylog", + name: name, location: location, - visitedDate: date, + date: date, }) .execute(); let res = await db .select() - .from(userVisitedAdventures) + .from(adventureTable) .where( and( - eq(userVisitedAdventures.userId, event.locals.user.id), - eq(userVisitedAdventures.adventureName, name), - eq(userVisitedAdventures.location, location), - eq(userVisitedAdventures.visitedDate, date) + eq(adventureTable.userId, event.locals.user.id), + eq(adventureTable.name, name), + eq(adventureTable.location, location), + eq(adventureTable.date, date) ) ) .execute(); @@ -121,7 +117,7 @@ export async function POST(event: RequestEvent): Promise { JSON.stringify({ adventure: { name, location, date }, message: { message: "Adventure added" }, - id: res[0].adventureID, + id: res[0].id, }), { status: 200, @@ -144,20 +140,22 @@ export async function PUT(event: RequestEvent): Promise { } // get properties from the body - const { id, name, location, date } = await event.request.json(); + const { newAdventure } = await event.request.json(); + console.log(newAdventure); + const { name, location, date, id } = newAdventure; // update the adventure in the user's visited list await db - .update(userVisitedAdventures) + .update(adventureTable) .set({ - adventureName: name, + name: name, location: location, - visitedDate: date, + date: date, }) .where( and( - eq(userVisitedAdventures.userId, event.locals.user.id), - eq(userVisitedAdventures.adventureID, Number(id)) + eq(adventureTable.userId, event.locals.user.id), + eq(adventureTable.id, Number(id)) ) ) .execute(); diff --git a/src/routes/log/+page.svelte b/src/routes/log/+page.svelte index 30f786f..5849516 100644 --- a/src/routes/log/+page.svelte +++ b/src/routes/log/+page.svelte @@ -28,7 +28,7 @@ // Sets the adventures array to the data from the server onMount(async () => { console.log(data); - adventures = data.result.adventures; + adventures = data.result; isLoading = false; }); @@ -63,15 +63,22 @@ let currentDate = new Date(); let dateString = currentDate.toISOString().slice(0, 10); // Get date in "yyyy-mm-dd" format // post to /api/visits + + let newAdventure: Adventure = { + type: "mylog", + name: newName, + location: newLocation, + date: dateString, + id: -1, + }; + fetch("/api/visits", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ - name: newName, - location: newLocation, - date: dateString, + newAdventure, }), }) .then((response) => response.json()) @@ -82,6 +89,7 @@ ...adventures, { id: newId, + type: "mylog", name: newName, location: newLocation, date: dateString, @@ -99,6 +107,15 @@ function saveAdventure(event: { detail: Adventure }) { console.log("Event" + event.detail); + + let newAdventure: Adventure = { + type: "mylog", + name: event.detail.name, + location: event.detail.location, + date: event.detail.date, + id: event.detail.id, + }; + // put request to /api/visits with id and advneture data fetch("/api/visits", { method: "PUT", @@ -106,10 +123,7 @@ "Content-Type": "application/json", }, body: JSON.stringify({ - id: event.detail.id, - name: event.detail.name, - location: event.detail.location, - date: event.detail.date, + newAdventure, }), }) .then((response) => response.json()) diff --git a/src/services/adventureService.ts b/src/services/adventureService.ts index 9e984f4..53ba034 100644 --- a/src/services/adventureService.ts +++ b/src/services/adventureService.ts @@ -1,40 +1 @@ import type { Adventure } from "$lib/utils/types"; - -let adventures: Adventure[] = []; - -import { visitCount } from "$lib/utils/stores/visitCountStore"; - -// Check if localStorage is available (browser environment) -const isBrowser = typeof window !== "undefined"; - -// - -export function getNextId() { - let nextId = Math.max(0, ...adventures.map((adventure) => adventure.id)) + 1; - return nextId; -} - -export function setAdventures(importArray: Adventure[]) { - adventures = importArray; -} - -export function addAdventure(adventure: Adventure) { - adventures = [...adventures, adventure]; - if (isBrowser) { - localStorage.setItem("adventures", JSON.stringify(adventures)); - visitCount.update((n) => n + 1); - } - console.log(adventures); -} - -export function getAdventures(): Adventure[] { - return adventures; -} - -export function clearAdventures() { - adventures = []; - if (isBrowser) { - localStorage.setItem("adventures", JSON.stringify(adventures)); - visitCount.set(0); - } -} From 319a99fed286a1938e5b793c3b13136330995438 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 26 Apr 2024 22:43:13 +0000 Subject: [PATCH 08/12] Refactor data insertion via Drizzle --- migrations/0012_quiet_katie_power.sql | 2 + migrations/meta/0012_snapshot.json | 565 ++++++++++++++++++++++++++ migrations/meta/_journal.json | 7 + sql/001_countries.sql | 36 +- sql/002_us.sql | 322 +++------------ sql/003_ca.sql | 32 +- sql/004_de.sql | 38 +- sql/005_fr.sql | 42 +- sql/006_gb.sql | 14 +- sql/007_ar.sql | 54 +-- sql/008_mx.sql | 68 ++-- sql/009_jp.sql | 100 ++--- sql/010_cn.sql | 68 ++-- sql/011_in.sql | 76 ++-- sql/012_au.sql | 22 +- sql/013_nz.sql | 38 +- sql/014_za.sql | 24 +- sql/015_eg.sql | 60 +-- sql/016_br.sql | 60 +-- sql/parks.sql | 15 - src/lib/db/insertData.ts | 505 +++++++++++++++++++++++ src/lib/db/schema.ts | 4 +- src/routes/featured/+page.server.ts | 8 +- src/routes/setup/+page.server.ts | 10 +- startup.sh | 2 +- 25 files changed, 1511 insertions(+), 661 deletions(-) create mode 100644 migrations/0012_quiet_katie_power.sql create mode 100644 migrations/meta/0012_snapshot.json delete mode 100644 sql/parks.sql create mode 100644 src/lib/db/insertData.ts diff --git a/migrations/0012_quiet_katie_power.sql b/migrations/0012_quiet_katie_power.sql new file mode 100644 index 0000000..3b9eec3 --- /dev/null +++ b/migrations/0012_quiet_katie_power.sql @@ -0,0 +1,2 @@ +ALTER TABLE "adventures" ALTER COLUMN "userId" DROP NOT NULL;--> statement-breakpoint +ALTER TABLE "adventures" ADD COLUMN "type" text NOT NULL; \ 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..1c5c64c --- /dev/null +++ b/migrations/meta/0012_snapshot.json @@ -0,0 +1,565 @@ +{ + "id": "f9d623fb-6563-4b3f-b4c2-6f2169f95e3b", + "prevId": "d1a58675-3daf-43e2-a9a1-c56767fc3d0e", + "version": "5", + "dialect": "pg", + "tables": { + "adventures": { + "name": "adventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activityTypes": { + "name": "activityTypes", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "imageUrl": { + "name": "imageUrl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "adventures_userId_user_id_fk": { + "name": "adventures_userId_user_id_fk", + "tableFrom": "adventures", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "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": {} + }, + "userPlannedAdventures": { + "name": "userPlannedAdventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventureName": { + "name": "adventureName", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activityTypes": { + "name": "activityTypes", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plannedDate": { + "name": "plannedDate", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userPlannedAdventures_userId_user_id_fk": { + "name": "userPlannedAdventures_userId_user_id_fk", + "tableFrom": "userPlannedAdventures", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "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 + }, + "signup_date": { + "name": "signup_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_login": { + "name": "last_login", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "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": {} + }, + "userVisitedWorldTravel": { + "name": "userVisitedWorldTravel", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "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_country_code_worldTravelCountries_country_code_fk": { + "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", + "tableFrom": "userVisitedWorldTravel", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_code" + ], + "columnsTo": [ + "country_code" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "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": "", + "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 + }, + "info": { + "name": "info", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "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 cbf0339..392dc84 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -85,6 +85,13 @@ "when": 1713746739294, "tag": "0011_bizarre_silver_samurai", "breakpoints": true + }, + { + "idx": 12, + "version": "5", + "when": 1714169595867, + "tag": "0012_quiet_katie_power", + "breakpoints": true } ] } \ No newline at end of file diff --git a/sql/001_countries.sql b/sql/001_countries.sql index 0608443..88e4e3f 100644 --- a/sql/001_countries.sql +++ b/sql/001_countries.sql @@ -1,18 +1,18 @@ -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') -ON CONFLICT (country_code) DO NOTHING; \ No newline at end of file +-- 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') +-- ON CONFLICT (country_code) DO NOTHING; \ No newline at end of file diff --git a/sql/002_us.sql b/sql/002_us.sql index efa1082..fbbd6af 100644 --- a/sql/002_us.sql +++ b/sql/002_us.sql @@ -1,270 +1,52 @@ --- INSERT INTO "worldTravelCountryRegions" (id, name, country_code) --- VALUES --- ('US-AL', 'Alabama', 'us', '{ --- "name": "Alabama", --- "abbreviation": "AL", --- "description": "Alabama is a state located in the southeastern region of the United States. Known for its rich history, including its role in the American Civil War and the Civil Rights Movement, Alabama offers a diverse landscape of mountains, plains, and coastal areas. The state boasts a humid subtropical climate and is known for its strong tradition in college sports, particularly football. Alabama''s economy is diverse, with major industries including automotive manufacturing, agriculture, and aerospace. Tourists are drawn to Alabama''s natural beauty, historical sites, and cultural landmarks.", --- "capital": "Montgomery", --- "largest_city": "Birmingham", --- "area": { --- "total": 52420, --- "units": "square miles" --- }, --- "population": { --- "estimate": 4903185, --- "year": 2020 --- }, --- "state_flower": "Camellia", --- "state_bird": "Yellowhammer", --- "state_tree": "Southern Longleaf Pine", --- "climate": { --- "description": "Humid subtropical", --- "summer_highs": "80-90°F", --- "winter_lows": "30-50°F", --- "precipitation": "Abundant throughout the year" --- }, --- "economy": { --- "industries": [ --- "Automotive Manufacturing", --- "Agriculture", --- "Mining", --- "Technology", --- "Aerospace" --- ], --- "agricultural_products": [ --- "Poultry", --- "Cotton", --- "Peanuts", --- "Soybeans", --- "Corn" --- ] --- }, --- "tourism": { --- "attractions": [ --- "U.S. Space & Rocket Center", --- "Gulf Shores and Orange Beach", --- "Rosa Parks Museum", --- "Civil Rights Institute", --- "Little River Canyon National Preserve" --- ] --- }, --- "major_sports_teams": [ --- "Alabama Crimson Tide (NCAA)", --- "Auburn Tigers (NCAA)" --- ] --- }'), --- ('US-AK', 'Alaska', 'us', '{ --- "name": "Alaska", --- "abbreviation": "AK", --- "description": "Alaska is the largest state in the United States by area, known for its rugged and breathtaking natural beauty. It is situated in the northwesternmost region of North America and is bordered by Canada to the east, the Arctic Ocean to the north, and the Pacific Ocean to the west and south. Alaska is renowned for its diverse wildlife, glaciers, and majestic mountains. The state is sparsely populated, with the majority of its residents living in and around Anchorage and Fairbanks. Alaska''s economy is heavily dependent on oil and gas production, as well as fishing, tourism, and mining.", --- "capital": "Juneau", --- "largest_city": "Anchorage", --- "area": { --- "total": 663267, --- "units": "square miles" --- }, --- "population": { --- "estimate": 731158, --- "year": 2020 --- }, --- "state_flower": "Forget-Me-Not", --- "state_bird": "Willow Ptarmigan", --- "state_tree": "Sitka Spruce", --- "climate": { --- "description": "Varies by region, with subarctic and arctic climates in the interior and north and more temperate maritime climates along the coast.", --- "summer_highs": "50-70°F (varies by region)", --- "winter_lows": "-40 to 20°F (varies by region)", --- "precipitation": "Ranges from low in the interior to high along the coast" --- }, --- "economy": { --- "industries": [ --- "Oil and Gas", --- "Fishing", --- "Mining", --- "Tourism", --- "Forestry" --- ], --- "agricultural_products": [ --- "Cattle", --- "Hay", --- "Vegetables", --- "Barley", --- "Dairy products" --- ] --- }, --- "tourism": { --- "attractions": [ --- "Denali National Park", --- "Glacier Bay National Park", --- "Kenai Fjords National Park", --- "Sitka National Historical Park", --- "Anchorage Museum" --- ] --- }, --- "major_sports_teams": [ --- "Anchorage Wolverines (NAHL)", --- "Alaska Aces (ECHL, formerly)" --- ] --- } --- '), --- ('US-AZ', 'Arizona', 'us', '{ --- "name": "Arizona", --- "abbreviation": "AZ", --- "description": "Arizona is a state located in the southwestern region of the United States, known for its dramatic desert landscapes and vibrant history. The state is home to iconic landmarks such as the Grand Canyon and Monument Valley. Arizona''s diverse geography includes mountain ranges, forests, and high plateaus. The state has a warm desert climate in the southern and central areas and cooler mountain climates in the northern region. Arizona''s economy is driven by industries such as healthcare, technology, manufacturing, and tourism.", --- "capital": "Phoenix", --- "largest_city": "Phoenix", --- "area": { --- "total": 113990, --- "units": "square miles" --- }, --- "population": { --- "estimate": 7151502, --- "year": 2020 --- }, --- "state_flower": "Saguaro Cactus Blossom", --- "state_bird": "Cactus Wren", --- "state_tree": "Palo Verde", --- "climate": { --- "description": "Mostly arid and semi-arid, with desert climates in the southern and central regions and temperate climates in the north.", --- "summer_highs": "85-120°F (varies by region)", --- "winter_lows": "30-60°F (varies by region)", --- "precipitation": "Low in most areas, with higher amounts in mountain regions" --- }, --- "economy": { --- "industries": [ --- "Healthcare", --- "Technology", --- "Manufacturing", --- "Tourism", --- "Agriculture" --- ], --- "agricultural_products": [ --- "Cattle", --- "Dairy", --- "Lettuce", --- "Cotton", --- "Alfalfa" --- ] --- }, --- "tourism": { --- "attractions": [ --- "Grand Canyon National Park", --- "Sedona", --- "Monument Valley", --- "Saguaro National Park", --- "Petrified Forest National Park" --- ] --- }, --- "major_sports_teams": [ --- "Arizona Cardinals (NFL)", --- "Phoenix Suns (NBA)", --- "Arizona Diamondbacks (MLB)", --- "Arizona Coyotes (NHL)" --- ] --- } --- '), --- ('US-AR', 'Arkansas', 'us', '{ --- "name": "Arkansas", --- "abbreviation": "AR", --- "description": "Arkansas is a state located in the southeastern region of the United States, known for its natural beauty and diverse landscapes that include mountains, forests, and rivers. The state is nicknamed ''The Natural State'' due to its abundant natural resources and outdoor recreational opportunities. Arkansas has a rich history and played a significant role during the American Civil War. The state''s economy is driven by agriculture, manufacturing, and tourism, with key agricultural products including rice, poultry, and soybeans.", --- "capital": "Little Rock", --- "largest_city": "Little Rock", --- "area": { --- "total": 53179, --- "units": "square miles" --- }, --- "population": { --- "estimate": 3013756, --- "year": 2020 --- }, --- "state_flower": "Apple Blossom", --- "state_bird": "Northern Mockingbird", --- "state_tree": "Pine", --- "climate": { --- "description": "Humid subtropical climate, with hot summers and mild winters.", --- "summer_highs": "80-90°F", --- "winter_lows": "20-40°F", --- "precipitation": "High, especially in the spring" --- }, --- "economy": { --- "industries": [ --- "Agriculture", --- "Manufacturing", --- "Retail", --- "Tourism", --- "Education" --- ], --- "agricultural_products": [ --- "Rice", --- "Poultry", --- "Soybeans", --- "Cotton", --- "Catfish" --- ] --- }, --- "tourism": { --- "attractions": [ --- "Hot Springs National Park", --- "Buffalo National River", --- "Crater of Diamonds State Park", --- "Little Rock Central High School National Historic Site", --- "Ozark National Forest" --- ] --- }, --- "major_sports_teams": [ --- "Arkansas Razorbacks (NCAA)" --- ] --- } --- '), -INSERT INTO "worldTravelCountryRegions" (id, name, country_code) VALUES - ('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; +-- INSERT INTO "worldTravelCountryRegions" (id, name, country_code) VALUES +-- ('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 14c777d..af22c55 100644 --- a/sql/003_ca.sql +++ b/sql/003_ca.sql @@ -1,16 +1,16 @@ -INSERT INTO "worldTravelCountryRegions" (id, name, country_code) -VALUES - ('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; +-- INSERT INTO "worldTravelCountryRegions" (id, name, country_code) +-- VALUES +-- ('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 a8be86c..b63dc17 100644 --- a/sql/004_de.sql +++ b/sql/004_de.sql @@ -1,20 +1,20 @@ -INSERT INTO "worldTravelCountryRegions" (id, name, country_code) -VALUES - ('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') +-- INSERT INTO "worldTravelCountryRegions" (id, name, country_code) +-- VALUES +-- ('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 (id) DO NOTHING; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/005_fr.sql b/sql/005_fr.sql index 08cabf5..66ffb6b 100644 --- a/sql/005_fr.sql +++ b/sql/005_fr.sql @@ -1,22 +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') +-- 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; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/006_gb.sql b/sql/006_gb.sql index c1a0ef9..46eb4fc 100644 --- a/sql/006_gb.sql +++ b/sql/006_gb.sql @@ -1,8 +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') +-- 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; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/007_ar.sql b/sql/007_ar.sql index 627335d..36ebceb 100644 --- a/sql/007_ar.sql +++ b/sql/007_ar.sql @@ -1,28 +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') +-- 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; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/008_mx.sql b/sql/008_mx.sql index 4f57691..5cfa889 100644 --- a/sql/008_mx.sql +++ b/sql/008_mx.sql @@ -1,35 +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') +-- 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; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/009_jp.sql b/sql/009_jp.sql index dda90b9..929da64 100644 --- a/sql/009_jp.sql +++ b/sql/009_jp.sql @@ -1,51 +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') +-- 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; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/010_cn.sql b/sql/010_cn.sql index c7353ae..7ac6afa 100644 --- a/sql/010_cn.sql +++ b/sql/010_cn.sql @@ -1,35 +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') +-- 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; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/011_in.sql b/sql/011_in.sql index 45c76b6..ca1cd00 100644 --- a/sql/011_in.sql +++ b/sql/011_in.sql @@ -1,39 +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') +-- 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; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/012_au.sql b/sql/012_au.sql index 8882314..0f1795c 100644 --- a/sql/012_au.sql +++ b/sql/012_au.sql @@ -1,12 +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') +-- 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; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/013_nz.sql b/sql/013_nz.sql index 9d20865..6a06a94 100644 --- a/sql/013_nz.sql +++ b/sql/013_nz.sql @@ -1,20 +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') +-- 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; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/014_za.sql b/sql/014_za.sql index 44b493c..6802465 100644 --- a/sql/014_za.sql +++ b/sql/014_za.sql @@ -1,13 +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') +-- 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; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/015_eg.sql b/sql/015_eg.sql index 21c5e66..8c33e39 100644 --- a/sql/015_eg.sql +++ b/sql/015_eg.sql @@ -1,31 +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') +-- 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; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/016_br.sql b/sql/016_br.sql index 6bbbd2b..ed4e093 100644 --- a/sql/016_br.sql +++ b/sql/016_br.sql @@ -1,31 +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') +-- 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; +-- ON CONFLICT (id) DO NOTHING; diff --git a/sql/parks.sql b/sql/parks.sql deleted file mode 100644 index 0afcd4e..0000000 --- a/sql/parks.sql +++ /dev/null @@ -1,15 +0,0 @@ --- INSERT INTO "adventures" (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/src/lib/db/insertData.ts b/src/lib/db/insertData.ts new file mode 100644 index 0000000..f6ab875 --- /dev/null +++ b/src/lib/db/insertData.ts @@ -0,0 +1,505 @@ +import { sql } from "drizzle-orm"; +import { db } from "./db.server"; + +export async function insertData() { + // insets default featured adventures + console.log("Inserting default featured adventures..."); + await db.execute(sql`INSERT INTO "adventures" (name, location, type) VALUES + ('Yellowstone National Park', 'Wyoming, Montana, Idaho, USA', 'featured'), + ('Yosemite National Park', 'California, USA', 'featured'), + ('Banff National Park', 'Alberta, Canada', 'featured'), + ('Kruger National Park', 'Limpopo, South Africa', 'featured'), + ('Grand Canyon National Park', 'Arizona, USA', 'featured'), + ('Great Smoky Mountains National Park', 'North Carolina, Tennessee, USA', 'featured'), + ('Zion National Park', 'Utah, USA', 'featured'), + ('Glacier National Park', 'Montana, USA', 'featured'), + ('Rocky Mountain National Park', 'Colorado, USA', 'featured'), + ('Everglades National Park', 'Florida, USA', 'featured'), + ('Arches National Park', 'Utah, USA', 'featured'), + ('Acadia National Park', 'Maine, USA', 'featured'), + ('Sequoia National Park', 'California, USA', 'featured');`); + + console.log("Inserting countries..."); + await db.execute(sql`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') + ON CONFLICT (country_code) DO NOTHING;`); + + console.log("Inserting regions..."); + await db.execute(sql`INSERT INTO "worldTravelCountryRegions" (id, name, country_code) VALUES + ('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; +`); + + await db.execute(sql`INSERT INTO "worldTravelCountryRegions" (id, name, country_code) + VALUES + ('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; + +`); + + await db.execute(sql`INSERT INTO "worldTravelCountryRegions" (id, name, country_code) + VALUES + ('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 (id) DO NOTHING; + +`); + + await db.execute(sql`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; + +`); + + await db.execute(sql`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; + +`); + + await db.execute(sql`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; + +`); + + await db.execute(sql`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; + +`); + + await db.execute(sql`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; + +`); + + await db.execute(sql`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; + +`); + + await db.execute(sql`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; + + +`); + + await db.execute(sql`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; + + +`); + + await db.execute(sql`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; + + +`); + + await db.execute(sql`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; + + +`); + + await db.execute(sql`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; + + +`); + + await db.execute(sql`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 99fc714..114db1e 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -107,9 +107,7 @@ export const userPlannedAdventures = pgTable("userPlannedAdventures", { export const adventureTable = pgTable("adventures", { id: serial("id").primaryKey(), type: text("type").notNull(), - userId: text("userId") - .notNull() - .references(() => userTable.id), + userId: text("userId").references(() => userTable.id), name: text("name").notNull(), location: text("location"), activityTypes: json("activityTypes"), diff --git a/src/routes/featured/+page.server.ts b/src/routes/featured/+page.server.ts index eb91938..c60aa47 100644 --- a/src/routes/featured/+page.server.ts +++ b/src/routes/featured/+page.server.ts @@ -1,12 +1,14 @@ import { db } from "$lib/db/db.server"; -import { featuredAdventures } from "$lib/db/schema"; +import { adventureTable, featuredAdventures } from "$lib/db/schema"; import type { Adventure } from "$lib/utils/types"; +import { eq } from "drizzle-orm"; export const load = async () => { const result = await db .select() - .from(featuredAdventures) - .orderBy(featuredAdventures.id); + .from(adventureTable) + .where(eq(adventureTable.type, "featured")) + .orderBy(adventureTable.id); return { result: result as Adventure[], }; diff --git a/src/routes/setup/+page.server.ts b/src/routes/setup/+page.server.ts index 12782f8..26bf6c1 100644 --- a/src/routes/setup/+page.server.ts +++ b/src/routes/setup/+page.server.ts @@ -8,7 +8,8 @@ import type { DatabaseUser } from "$lib/server/auth"; import type { Actions } from "./$types"; import { userTable } from "$lib/db/schema"; -import { eq } from "drizzle-orm"; +import { eq, sql } from "drizzle-orm"; +import { insertData } from "$lib/db/insertData"; export const actions: Actions = { default: async (event) => { @@ -109,8 +110,11 @@ export const actions: Actions = { } as DatabaseUser) .execute(); - const session = await lucia.createSession(userId, {}); - const sessionCookie = lucia.createSessionCookie(session.id); + // inserts the data needed for all of the pre defined adventures and world travel regions + await insertData(); + + const session: any = await lucia.createSession(userId, {}); + const sessionCookie: any = lucia.createSessionCookie(session.id); event.cookies.set(sessionCookie.name, sessionCookie.value, { path: ".", ...sessionCookie.attributes, diff --git a/startup.sh b/startup.sh index 2eafe63..1914533 100644 --- a/startup.sh +++ b/startup.sh @@ -44,7 +44,7 @@ fi npm run migrate # Run SQL scripts -run_sql_scripts +# run_sql_scripts echo "The origin to be set is: $ORIGIN" # Start the application From db8fc061f275fc7ee0f58681e49efe96b41a6171 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 26 Apr 2024 22:43:27 +0000 Subject: [PATCH 09/12] Refactor database schema and remove unused SQL files --- sql/001_countries.sql | 18 --------------- sql/002_us.sql | 52 ------------------------------------------- sql/003_ca.sql | 16 ------------- sql/004_de.sql | 20 ----------------- 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 ------------------------------------------ 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 -------------------------- 16 files changed, 431 deletions(-) delete mode 100644 sql/001_countries.sql delete mode 100644 sql/002_us.sql delete mode 100644 sql/003_ca.sql delete mode 100644 sql/004_de.sql delete mode 100644 sql/005_fr.sql delete mode 100644 sql/006_gb.sql delete mode 100644 sql/007_ar.sql delete mode 100644 sql/008_mx.sql delete mode 100644 sql/009_jp.sql delete mode 100644 sql/010_cn.sql delete mode 100644 sql/011_in.sql delete mode 100644 sql/012_au.sql delete mode 100644 sql/013_nz.sql delete mode 100644 sql/014_za.sql delete mode 100644 sql/015_eg.sql delete mode 100644 sql/016_br.sql diff --git a/sql/001_countries.sql b/sql/001_countries.sql deleted file mode 100644 index 88e4e3f..0000000 --- a/sql/001_countries.sql +++ /dev/null @@ -1,18 +0,0 @@ --- 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') --- ON CONFLICT (country_code) DO NOTHING; \ No newline at end of file diff --git a/sql/002_us.sql b/sql/002_us.sql deleted file mode 100644 index fbbd6af..0000000 --- a/sql/002_us.sql +++ /dev/null @@ -1,52 +0,0 @@ --- INSERT INTO "worldTravelCountryRegions" (id, name, country_code) VALUES --- ('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 deleted file mode 100644 index af22c55..0000000 --- a/sql/003_ca.sql +++ /dev/null @@ -1,16 +0,0 @@ --- INSERT INTO "worldTravelCountryRegions" (id, name, country_code) --- VALUES --- ('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 deleted file mode 100644 index b63dc17..0000000 --- a/sql/004_de.sql +++ /dev/null @@ -1,20 +0,0 @@ --- INSERT INTO "worldTravelCountryRegions" (id, name, country_code) --- VALUES --- ('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 (id) DO NOTHING; diff --git a/sql/005_fr.sql b/sql/005_fr.sql deleted file mode 100644 index 66ffb6b..0000000 --- a/sql/005_fr.sql +++ /dev/null @@ -1,22 +0,0 @@ --- 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 deleted file mode 100644 index 46eb4fc..0000000 --- a/sql/006_gb.sql +++ /dev/null @@ -1,8 +0,0 @@ --- 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 deleted file mode 100644 index 36ebceb..0000000 --- a/sql/007_ar.sql +++ /dev/null @@ -1,28 +0,0 @@ --- 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 deleted file mode 100644 index 5cfa889..0000000 --- a/sql/008_mx.sql +++ /dev/null @@ -1,35 +0,0 @@ --- 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 deleted file mode 100644 index 929da64..0000000 --- a/sql/009_jp.sql +++ /dev/null @@ -1,51 +0,0 @@ --- 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/sql/010_cn.sql b/sql/010_cn.sql deleted file mode 100644 index 7ac6afa..0000000 --- a/sql/010_cn.sql +++ /dev/null @@ -1,35 +0,0 @@ --- 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 deleted file mode 100644 index ca1cd00..0000000 --- a/sql/011_in.sql +++ /dev/null @@ -1,39 +0,0 @@ --- 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 deleted file mode 100644 index 0f1795c..0000000 --- a/sql/012_au.sql +++ /dev/null @@ -1,12 +0,0 @@ --- 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 deleted file mode 100644 index 6a06a94..0000000 --- a/sql/013_nz.sql +++ /dev/null @@ -1,20 +0,0 @@ --- 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 deleted file mode 100644 index 6802465..0000000 --- a/sql/014_za.sql +++ /dev/null @@ -1,13 +0,0 @@ --- 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 deleted file mode 100644 index 8c33e39..0000000 --- a/sql/015_eg.sql +++ /dev/null @@ -1,31 +0,0 @@ --- 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 deleted file mode 100644 index ed4e093..0000000 --- a/sql/016_br.sql +++ /dev/null @@ -1,31 +0,0 @@ --- 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; From 08579289a6175dec4fe84ab326b873b75cee4c13 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 26 Apr 2024 23:04:41 +0000 Subject: [PATCH 10/12] Remove userVisitedAdventuresTable --- migrations/0000_hard_mach_iv.sql | 86 --- migrations/0001_closed_wendell_vaughn.sql | 6 - migrations/0002_far_mephistopheles.sql | 1 - migrations/0003_easy_iron_monger.sql | 3 - migrations/0004_noisy_squadron_supreme.sql | 13 - migrations/0005_massive_black_tarantula.sql | 1 - migrations/0006_colorful_inertia.sql | 10 - migrations/0007_clear_sinister_six.sql | 2 - migrations/0008_open_forgotten_one.sql | 18 - migrations/0009_clammy_meteorite.sql | 1 - migrations/0010_dazzling_morbius.sql | 1 - migrations/0011_bizarre_silver_samurai.sql | 1 - migrations/0012_quiet_katie_power.sql | 2 - migrations/meta/0000_snapshot.json | 366 ------------- migrations/meta/0001_snapshot.json | 385 ------------- migrations/meta/0002_snapshot.json | 391 -------------- migrations/meta/0003_snapshot.json | 409 -------------- migrations/meta/0004_snapshot.json | 463 ---------------- migrations/meta/0005_snapshot.json | 463 ---------------- migrations/meta/0006_snapshot.json | 463 ---------------- migrations/meta/0007_snapshot.json | 475 ---------------- migrations/meta/0008_snapshot.json | 559 ------------------- migrations/meta/0009_snapshot.json | 559 ------------------- migrations/meta/0010_snapshot.json | 559 ------------------- migrations/meta/0011_snapshot.json | 559 ------------------- migrations/meta/0012_snapshot.json | 565 -------------------- migrations/meta/_journal.json | 97 ---- src/hooks.server.ts | 27 +- src/lib/db/schema.ts | 10 - src/routes/+page.svelte | 8 + src/routes/api/clearvisits/+server.ts | 34 +- src/routes/api/regionvisit/+server.ts | 114 ++-- src/routes/api/visitcount/+server.ts | 56 +- src/routes/api/visits/+server.ts | 2 +- src/routes/featured/+page.svelte | 12 +- src/routes/settings/admin/+page.server.ts | 4 +- 36 files changed, 132 insertions(+), 6593 deletions(-) delete mode 100644 migrations/0000_hard_mach_iv.sql delete mode 100644 migrations/0001_closed_wendell_vaughn.sql delete mode 100644 migrations/0002_far_mephistopheles.sql delete mode 100644 migrations/0003_easy_iron_monger.sql delete mode 100644 migrations/0004_noisy_squadron_supreme.sql delete mode 100644 migrations/0005_massive_black_tarantula.sql delete mode 100644 migrations/0006_colorful_inertia.sql delete mode 100644 migrations/0007_clear_sinister_six.sql delete mode 100644 migrations/0008_open_forgotten_one.sql delete mode 100644 migrations/0009_clammy_meteorite.sql delete mode 100644 migrations/0010_dazzling_morbius.sql delete mode 100644 migrations/0011_bizarre_silver_samurai.sql delete mode 100644 migrations/0012_quiet_katie_power.sql delete mode 100644 migrations/meta/0000_snapshot.json 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/_journal.json diff --git a/migrations/0000_hard_mach_iv.sql b/migrations/0000_hard_mach_iv.sql deleted file mode 100644 index 5c9c0d1..0000000 --- a/migrations/0000_hard_mach_iv.sql +++ /dev/null @@ -1,86 +0,0 @@ -CREATE TABLE IF NOT EXISTS "featuredAdventures" ( - "id" serial PRIMARY KEY NOT NULL, - "name" text NOT NULL, - "location" text, - CONSTRAINT "featuredAdventures_name_unique" UNIQUE("name") -); ---> 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 "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, - CONSTRAINT "worldTravelCountries_country_code_unique" UNIQUE("country_code") -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "worldTravelCountryRegions" ( - "id" varchar PRIMARY KEY NOT NULL, - "name" text NOT NULL, - "country_code" 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 "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_closed_wendell_vaughn.sql b/migrations/0001_closed_wendell_vaughn.sql deleted file mode 100644 index 9f9d831..0000000 --- a/migrations/0001_closed_wendell_vaughn.sql +++ /dev/null @@ -1,6 +0,0 @@ -ALTER TABLE "userVisitedWorldTravel" ADD COLUMN "country_code" text NOT NULL;--> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "userVisitedWorldTravel" ADD CONSTRAINT "userVisitedWorldTravel_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/0002_far_mephistopheles.sql b/migrations/0002_far_mephistopheles.sql deleted file mode 100644 index 5a0139a..0000000 --- a/migrations/0002_far_mephistopheles.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "worldTravelCountryRegions" ADD COLUMN "info" json; \ No newline at end of file diff --git a/migrations/0003_easy_iron_monger.sql b/migrations/0003_easy_iron_monger.sql deleted file mode 100644 index 8d6046e..0000000 --- a/migrations/0003_easy_iron_monger.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE "user" ADD COLUMN "signup_date" timestamp with time zone NOT NULL;--> statement-breakpoint -ALTER TABLE "user" ADD COLUMN "last_login" timestamp with time zone;--> statement-breakpoint -ALTER TABLE "user" ADD COLUMN "role" text NOT NULL; \ No newline at end of file diff --git a/migrations/0004_noisy_squadron_supreme.sql b/migrations/0004_noisy_squadron_supreme.sql deleted file mode 100644 index 73b4715..0000000 --- a/migrations/0004_noisy_squadron_supreme.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE IF NOT EXISTS "userPlannedAdventures" ( - "id" serial PRIMARY KEY NOT NULL, - "user_id" text NOT NULL, - "adventure_name" text NOT NULL, - "location" text, - "activity_types" text -); ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "userPlannedAdventures" ADD CONSTRAINT "userPlannedAdventures_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_massive_black_tarantula.sql b/migrations/0005_massive_black_tarantula.sql deleted file mode 100644 index 8bd5e95..0000000 --- a/migrations/0005_massive_black_tarantula.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "userPlannedAdventures" ALTER COLUMN "activity_types" SET DATA TYPE json; \ No newline at end of file diff --git a/migrations/0006_colorful_inertia.sql b/migrations/0006_colorful_inertia.sql deleted file mode 100644 index dab5474..0000000 --- a/migrations/0006_colorful_inertia.sql +++ /dev/null @@ -1,10 +0,0 @@ -ALTER TABLE "userPlannedAdventures" RENAME COLUMN "user_id" TO "userId";--> statement-breakpoint -ALTER TABLE "userPlannedAdventures" RENAME COLUMN "adventure_name" TO "adventureName";--> statement-breakpoint -ALTER TABLE "userPlannedAdventures" RENAME COLUMN "activity_types" TO "activityTypes";--> statement-breakpoint -ALTER TABLE "userPlannedAdventures" DROP CONSTRAINT "userPlannedAdventures_user_id_user_id_fk"; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "userPlannedAdventures" ADD CONSTRAINT "userPlannedAdventures_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; diff --git a/migrations/0007_clear_sinister_six.sql b/migrations/0007_clear_sinister_six.sql deleted file mode 100644 index 820c4bd..0000000 --- a/migrations/0007_clear_sinister_six.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "userPlannedAdventures" ADD COLUMN "description" text;--> statement-breakpoint -ALTER TABLE "userPlannedAdventures" ADD COLUMN "plannedDate" text; \ No newline at end of file diff --git a/migrations/0008_open_forgotten_one.sql b/migrations/0008_open_forgotten_one.sql deleted file mode 100644 index 8d020da..0000000 --- a/migrations/0008_open_forgotten_one.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE IF NOT EXISTS "adventures" ( - "id" serial PRIMARY KEY NOT NULL, - "userId" text NOT NULL, - "adventureName" text NOT NULL, - "location" text, - "activityTypes" json, - "description" text, - "rating" integer, - "link" text, - "imageUrl" text, - "date" text -); ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "adventures" ADD CONSTRAINT "adventures_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; diff --git a/migrations/0009_clammy_meteorite.sql b/migrations/0009_clammy_meteorite.sql deleted file mode 100644 index 9ba6b21..0000000 --- a/migrations/0009_clammy_meteorite.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "adventures" RENAME COLUMN "adventureName" TO "name"; \ No newline at end of file diff --git a/migrations/0010_dazzling_morbius.sql b/migrations/0010_dazzling_morbius.sql deleted file mode 100644 index e49b9b0..0000000 --- a/migrations/0010_dazzling_morbius.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "userPlannedAdventures" ALTER COLUMN "userId" DROP NOT NULL; \ No newline at end of file diff --git a/migrations/0011_bizarre_silver_samurai.sql b/migrations/0011_bizarre_silver_samurai.sql deleted file mode 100644 index 313722a..0000000 --- a/migrations/0011_bizarre_silver_samurai.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "userPlannedAdventures" ALTER COLUMN "userId" SET NOT NULL; \ No newline at end of file diff --git a/migrations/0012_quiet_katie_power.sql b/migrations/0012_quiet_katie_power.sql deleted file mode 100644 index 3b9eec3..0000000 --- a/migrations/0012_quiet_katie_power.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "adventures" ALTER COLUMN "userId" DROP NOT NULL;--> statement-breakpoint -ALTER TABLE "adventures" ADD COLUMN "type" text NOT NULL; \ No newline at end of file diff --git a/migrations/meta/0000_snapshot.json b/migrations/meta/0000_snapshot.json deleted file mode 100644 index f038117..0000000 --- a/migrations/meta/0000_snapshot.json +++ /dev/null @@ -1,366 +0,0 @@ -{ - "id": "b6ab23b7-42f0-4475-aa5d-23b92c00e97f", - "prevId": "00000000-0000-0000-0000-000000000000", - "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": {} - }, - "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": "", - "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/0001_snapshot.json b/migrations/meta/0001_snapshot.json deleted file mode 100644 index 6c4e538..0000000 --- a/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,385 +0,0 @@ -{ - "id": "4c095e1a-9f13-4899-aa83-f56864191f51", - "prevId": "b6ab23b7-42f0-4475-aa5d-23b92c00e97f", - "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": {} - }, - "userVisitedWorldTravel": { - "name": "userVisitedWorldTravel", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "country_code": { - "name": "country_code", - "type": "text", - "primaryKey": false, - "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_country_code_worldTravelCountries_country_code_fk": { - "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", - "tableFrom": "userVisitedWorldTravel", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_code" - ], - "columnsTo": [ - "country_code" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "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": "", - "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/0002_snapshot.json b/migrations/meta/0002_snapshot.json deleted file mode 100644 index f84336c..0000000 --- a/migrations/meta/0002_snapshot.json +++ /dev/null @@ -1,391 +0,0 @@ -{ - "id": "91692e84-91ec-4411-ad9d-7b8b14f67dda", - "prevId": "4c095e1a-9f13-4899-aa83-f56864191f51", - "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": {} - }, - "userVisitedWorldTravel": { - "name": "userVisitedWorldTravel", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "country_code": { - "name": "country_code", - "type": "text", - "primaryKey": false, - "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_country_code_worldTravelCountries_country_code_fk": { - "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", - "tableFrom": "userVisitedWorldTravel", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_code" - ], - "columnsTo": [ - "country_code" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "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": "", - "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 - }, - "info": { - "name": "info", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "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/0003_snapshot.json b/migrations/meta/0003_snapshot.json deleted file mode 100644 index dc62400..0000000 --- a/migrations/meta/0003_snapshot.json +++ /dev/null @@ -1,409 +0,0 @@ -{ - "id": "72cc9a9a-a12e-4ca2-b644-b704673af4d7", - "prevId": "91692e84-91ec-4411-ad9d-7b8b14f67dda", - "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 - }, - "signup_date": { - "name": "signup_date", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "last_login": { - "name": "last_login", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "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": {} - }, - "userVisitedWorldTravel": { - "name": "userVisitedWorldTravel", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "country_code": { - "name": "country_code", - "type": "text", - "primaryKey": false, - "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_country_code_worldTravelCountries_country_code_fk": { - "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", - "tableFrom": "userVisitedWorldTravel", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_code" - ], - "columnsTo": [ - "country_code" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "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": "", - "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 - }, - "info": { - "name": "info", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "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/0004_snapshot.json b/migrations/meta/0004_snapshot.json deleted file mode 100644 index a3cad2e..0000000 --- a/migrations/meta/0004_snapshot.json +++ /dev/null @@ -1,463 +0,0 @@ -{ - "id": "4ed4f0d5-7731-49a1-ab2f-9af3aad2c95c", - "prevId": "72cc9a9a-a12e-4ca2-b644-b704673af4d7", - "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": {} - }, - "userPlannedAdventures": { - "name": "userPlannedAdventures", - "schema": "", - "columns": { - "id": { - "name": "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 - }, - "activity_types": { - "name": "activity_types", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userPlannedAdventures_user_id_user_id_fk": { - "name": "userPlannedAdventures_user_id_user_id_fk", - "tableFrom": "userPlannedAdventures", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "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 - }, - "signup_date": { - "name": "signup_date", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "last_login": { - "name": "last_login", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "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": {} - }, - "userVisitedWorldTravel": { - "name": "userVisitedWorldTravel", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "country_code": { - "name": "country_code", - "type": "text", - "primaryKey": false, - "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_country_code_worldTravelCountries_country_code_fk": { - "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", - "tableFrom": "userVisitedWorldTravel", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_code" - ], - "columnsTo": [ - "country_code" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "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": "", - "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 - }, - "info": { - "name": "info", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "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/0005_snapshot.json b/migrations/meta/0005_snapshot.json deleted file mode 100644 index 8b41890..0000000 --- a/migrations/meta/0005_snapshot.json +++ /dev/null @@ -1,463 +0,0 @@ -{ - "id": "f3c33262-0fe7-4b0f-8522-82e337da26d5", - "prevId": "4ed4f0d5-7731-49a1-ab2f-9af3aad2c95c", - "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": {} - }, - "userPlannedAdventures": { - "name": "userPlannedAdventures", - "schema": "", - "columns": { - "id": { - "name": "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 - }, - "activity_types": { - "name": "activity_types", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userPlannedAdventures_user_id_user_id_fk": { - "name": "userPlannedAdventures_user_id_user_id_fk", - "tableFrom": "userPlannedAdventures", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "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 - }, - "signup_date": { - "name": "signup_date", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "last_login": { - "name": "last_login", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "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": {} - }, - "userVisitedWorldTravel": { - "name": "userVisitedWorldTravel", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "country_code": { - "name": "country_code", - "type": "text", - "primaryKey": false, - "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_country_code_worldTravelCountries_country_code_fk": { - "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", - "tableFrom": "userVisitedWorldTravel", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_code" - ], - "columnsTo": [ - "country_code" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "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": "", - "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 - }, - "info": { - "name": "info", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "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/0006_snapshot.json b/migrations/meta/0006_snapshot.json deleted file mode 100644 index b5672e8..0000000 --- a/migrations/meta/0006_snapshot.json +++ /dev/null @@ -1,463 +0,0 @@ -{ - "id": "42010132-1400-4431-800b-7ecd45c7aa9a", - "prevId": "f3c33262-0fe7-4b0f-8522-82e337da26d5", - "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": {} - }, - "userPlannedAdventures": { - "name": "userPlannedAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "adventureName": { - "name": "adventureName", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activityTypes": { - "name": "activityTypes", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userPlannedAdventures_userId_user_id_fk": { - "name": "userPlannedAdventures_userId_user_id_fk", - "tableFrom": "userPlannedAdventures", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "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 - }, - "signup_date": { - "name": "signup_date", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "last_login": { - "name": "last_login", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "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": {} - }, - "userVisitedWorldTravel": { - "name": "userVisitedWorldTravel", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "country_code": { - "name": "country_code", - "type": "text", - "primaryKey": false, - "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_country_code_worldTravelCountries_country_code_fk": { - "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", - "tableFrom": "userVisitedWorldTravel", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_code" - ], - "columnsTo": [ - "country_code" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "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": "", - "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 - }, - "info": { - "name": "info", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "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/0007_snapshot.json b/migrations/meta/0007_snapshot.json deleted file mode 100644 index 740c68e..0000000 --- a/migrations/meta/0007_snapshot.json +++ /dev/null @@ -1,475 +0,0 @@ -{ - "id": "2dd5d59b-9e77-4a7a-9287-65e6b2456eab", - "prevId": "42010132-1400-4431-800b-7ecd45c7aa9a", - "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": {} - }, - "userPlannedAdventures": { - "name": "userPlannedAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "adventureName": { - "name": "adventureName", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activityTypes": { - "name": "activityTypes", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "plannedDate": { - "name": "plannedDate", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userPlannedAdventures_userId_user_id_fk": { - "name": "userPlannedAdventures_userId_user_id_fk", - "tableFrom": "userPlannedAdventures", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "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 - }, - "signup_date": { - "name": "signup_date", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "last_login": { - "name": "last_login", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "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": {} - }, - "userVisitedWorldTravel": { - "name": "userVisitedWorldTravel", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "country_code": { - "name": "country_code", - "type": "text", - "primaryKey": false, - "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_country_code_worldTravelCountries_country_code_fk": { - "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", - "tableFrom": "userVisitedWorldTravel", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_code" - ], - "columnsTo": [ - "country_code" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "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": "", - "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 - }, - "info": { - "name": "info", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "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/0008_snapshot.json b/migrations/meta/0008_snapshot.json deleted file mode 100644 index 3b1af89..0000000 --- a/migrations/meta/0008_snapshot.json +++ /dev/null @@ -1,559 +0,0 @@ -{ - "id": "4ef5cc7c-16cb-44d1-8a35-9989fbae87b2", - "prevId": "2dd5d59b-9e77-4a7a-9287-65e6b2456eab", - "version": "5", - "dialect": "pg", - "tables": { - "adventures": { - "name": "adventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "adventureName": { - "name": "adventureName", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activityTypes": { - "name": "activityTypes", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rating": { - "name": "rating", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "link": { - "name": "link", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "imageUrl": { - "name": "imageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "adventures_userId_user_id_fk": { - "name": "adventures_userId_user_id_fk", - "tableFrom": "adventures", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "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": {} - }, - "userPlannedAdventures": { - "name": "userPlannedAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "adventureName": { - "name": "adventureName", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activityTypes": { - "name": "activityTypes", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "plannedDate": { - "name": "plannedDate", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userPlannedAdventures_userId_user_id_fk": { - "name": "userPlannedAdventures_userId_user_id_fk", - "tableFrom": "userPlannedAdventures", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "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 - }, - "signup_date": { - "name": "signup_date", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "last_login": { - "name": "last_login", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "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": {} - }, - "userVisitedWorldTravel": { - "name": "userVisitedWorldTravel", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "country_code": { - "name": "country_code", - "type": "text", - "primaryKey": false, - "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_country_code_worldTravelCountries_country_code_fk": { - "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", - "tableFrom": "userVisitedWorldTravel", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_code" - ], - "columnsTo": [ - "country_code" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "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": "", - "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 - }, - "info": { - "name": "info", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "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/0009_snapshot.json b/migrations/meta/0009_snapshot.json deleted file mode 100644 index 2b780c0..0000000 --- a/migrations/meta/0009_snapshot.json +++ /dev/null @@ -1,559 +0,0 @@ -{ - "id": "e79b9053-4a84-4d6f-b6ac-b28a12a2edb8", - "prevId": "4ef5cc7c-16cb-44d1-8a35-9989fbae87b2", - "version": "5", - "dialect": "pg", - "tables": { - "adventures": { - "name": "adventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activityTypes": { - "name": "activityTypes", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rating": { - "name": "rating", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "link": { - "name": "link", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "imageUrl": { - "name": "imageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "adventures_userId_user_id_fk": { - "name": "adventures_userId_user_id_fk", - "tableFrom": "adventures", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "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": {} - }, - "userPlannedAdventures": { - "name": "userPlannedAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "adventureName": { - "name": "adventureName", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activityTypes": { - "name": "activityTypes", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "plannedDate": { - "name": "plannedDate", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userPlannedAdventures_userId_user_id_fk": { - "name": "userPlannedAdventures_userId_user_id_fk", - "tableFrom": "userPlannedAdventures", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "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 - }, - "signup_date": { - "name": "signup_date", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "last_login": { - "name": "last_login", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "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": {} - }, - "userVisitedWorldTravel": { - "name": "userVisitedWorldTravel", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "country_code": { - "name": "country_code", - "type": "text", - "primaryKey": false, - "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_country_code_worldTravelCountries_country_code_fk": { - "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", - "tableFrom": "userVisitedWorldTravel", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_code" - ], - "columnsTo": [ - "country_code" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "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": "", - "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 - }, - "info": { - "name": "info", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "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 c63b3cc..0000000 --- a/migrations/meta/0010_snapshot.json +++ /dev/null @@ -1,559 +0,0 @@ -{ - "id": "a826933a-d744-4ac7-8858-43be4f4fd078", - "prevId": "e79b9053-4a84-4d6f-b6ac-b28a12a2edb8", - "version": "5", - "dialect": "pg", - "tables": { - "adventures": { - "name": "adventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activityTypes": { - "name": "activityTypes", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rating": { - "name": "rating", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "link": { - "name": "link", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "imageUrl": { - "name": "imageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "adventures_userId_user_id_fk": { - "name": "adventures_userId_user_id_fk", - "tableFrom": "adventures", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "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": {} - }, - "userPlannedAdventures": { - "name": "userPlannedAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "adventureName": { - "name": "adventureName", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activityTypes": { - "name": "activityTypes", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "plannedDate": { - "name": "plannedDate", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userPlannedAdventures_userId_user_id_fk": { - "name": "userPlannedAdventures_userId_user_id_fk", - "tableFrom": "userPlannedAdventures", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "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 - }, - "signup_date": { - "name": "signup_date", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "last_login": { - "name": "last_login", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "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": {} - }, - "userVisitedWorldTravel": { - "name": "userVisitedWorldTravel", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "country_code": { - "name": "country_code", - "type": "text", - "primaryKey": false, - "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_country_code_worldTravelCountries_country_code_fk": { - "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", - "tableFrom": "userVisitedWorldTravel", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_code" - ], - "columnsTo": [ - "country_code" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "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": "", - "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 - }, - "info": { - "name": "info", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "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 3d17ff8..0000000 --- a/migrations/meta/0011_snapshot.json +++ /dev/null @@ -1,559 +0,0 @@ -{ - "id": "d1a58675-3daf-43e2-a9a1-c56767fc3d0e", - "prevId": "a826933a-d744-4ac7-8858-43be4f4fd078", - "version": "5", - "dialect": "pg", - "tables": { - "adventures": { - "name": "adventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activityTypes": { - "name": "activityTypes", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rating": { - "name": "rating", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "link": { - "name": "link", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "imageUrl": { - "name": "imageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "adventures_userId_user_id_fk": { - "name": "adventures_userId_user_id_fk", - "tableFrom": "adventures", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "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": {} - }, - "userPlannedAdventures": { - "name": "userPlannedAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "adventureName": { - "name": "adventureName", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activityTypes": { - "name": "activityTypes", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "plannedDate": { - "name": "plannedDate", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userPlannedAdventures_userId_user_id_fk": { - "name": "userPlannedAdventures_userId_user_id_fk", - "tableFrom": "userPlannedAdventures", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "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 - }, - "signup_date": { - "name": "signup_date", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "last_login": { - "name": "last_login", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "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": {} - }, - "userVisitedWorldTravel": { - "name": "userVisitedWorldTravel", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "country_code": { - "name": "country_code", - "type": "text", - "primaryKey": false, - "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_country_code_worldTravelCountries_country_code_fk": { - "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", - "tableFrom": "userVisitedWorldTravel", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_code" - ], - "columnsTo": [ - "country_code" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "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": "", - "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 - }, - "info": { - "name": "info", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "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/0012_snapshot.json b/migrations/meta/0012_snapshot.json deleted file mode 100644 index 1c5c64c..0000000 --- a/migrations/meta/0012_snapshot.json +++ /dev/null @@ -1,565 +0,0 @@ -{ - "id": "f9d623fb-6563-4b3f-b4c2-6f2169f95e3b", - "prevId": "d1a58675-3daf-43e2-a9a1-c56767fc3d0e", - "version": "5", - "dialect": "pg", - "tables": { - "adventures": { - "name": "adventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activityTypes": { - "name": "activityTypes", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rating": { - "name": "rating", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "link": { - "name": "link", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "imageUrl": { - "name": "imageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "adventures_userId_user_id_fk": { - "name": "adventures_userId_user_id_fk", - "tableFrom": "adventures", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "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": {} - }, - "userPlannedAdventures": { - "name": "userPlannedAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "adventureName": { - "name": "adventureName", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activityTypes": { - "name": "activityTypes", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "plannedDate": { - "name": "plannedDate", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userPlannedAdventures_userId_user_id_fk": { - "name": "userPlannedAdventures_userId_user_id_fk", - "tableFrom": "userPlannedAdventures", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "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 - }, - "signup_date": { - "name": "signup_date", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "last_login": { - "name": "last_login", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "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": {} - }, - "userVisitedWorldTravel": { - "name": "userVisitedWorldTravel", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "country_code": { - "name": "country_code", - "type": "text", - "primaryKey": false, - "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_country_code_worldTravelCountries_country_code_fk": { - "name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk", - "tableFrom": "userVisitedWorldTravel", - "tableTo": "worldTravelCountries", - "columnsFrom": [ - "country_code" - ], - "columnsTo": [ - "country_code" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "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": "", - "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 - }, - "info": { - "name": "info", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "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 deleted file mode 100644 index 392dc84..0000000 --- a/migrations/meta/_journal.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "version": "5", - "dialect": "pg", - "entries": [ - { - "idx": 0, - "version": "5", - "when": 1713037717607, - "tag": "0000_hard_mach_iv", - "breakpoints": true - }, - { - "idx": 1, - "version": "5", - "when": 1713050481064, - "tag": "0001_closed_wendell_vaughn", - "breakpoints": true - }, - { - "idx": 2, - "version": "5", - "when": 1713125110816, - "tag": "0002_far_mephistopheles", - "breakpoints": true - }, - { - "idx": 3, - "version": "5", - "when": 1713402092365, - "tag": "0003_easy_iron_monger", - "breakpoints": true - }, - { - "idx": 4, - "version": "5", - "when": 1713737819317, - "tag": "0004_noisy_squadron_supreme", - "breakpoints": true - }, - { - "idx": 5, - "version": "5", - "when": 1713738940329, - "tag": "0005_massive_black_tarantula", - "breakpoints": true - }, - { - "idx": 6, - "version": "5", - "when": 1713739045755, - "tag": "0006_colorful_inertia", - "breakpoints": true - }, - { - "idx": 7, - "version": "5", - "when": 1713739446962, - "tag": "0007_clear_sinister_six", - "breakpoints": true - }, - { - "idx": 8, - "version": "5", - "when": 1713746555380, - "tag": "0008_open_forgotten_one", - "breakpoints": true - }, - { - "idx": 9, - "version": "5", - "when": 1713746620778, - "tag": "0009_clammy_meteorite", - "breakpoints": true - }, - { - "idx": 10, - "version": "5", - "when": 1713746685965, - "tag": "0010_dazzling_morbius", - "breakpoints": true - }, - { - "idx": 11, - "version": "5", - "when": 1713746739294, - "tag": "0011_bizarre_silver_samurai", - "breakpoints": true - }, - { - "idx": 12, - "version": "5", - "when": 1714169595867, - "tag": "0012_quiet_katie_power", - "breakpoints": true - } - ] -} \ No newline at end of file diff --git a/src/hooks.server.ts b/src/hooks.server.ts index caa3471..d6a50eb 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -1,6 +1,6 @@ import { lucia } from "$lib/server/auth"; import { redirect, type Handle } from "@sveltejs/kit"; -import { sequence } from '@sveltejs/kit/hooks'; +import { sequence } from "@sveltejs/kit/hooks"; import { db } from "$lib/db/db.server"; import { userTable } from "$lib/db/schema"; import { eq } from "drizzle-orm"; @@ -24,7 +24,7 @@ export const authHook: Handle = async ({ event, resolve }) => { }); } if (!session) { - const sessionCookie:any = lucia.createBlankSessionCookie(); + const sessionCookie: any = lucia.createBlankSessionCookie(); event.cookies.set(sessionCookie.name, sessionCookie.value, { path: ".", ...sessionCookie.attributes, @@ -36,12 +36,12 @@ export const authHook: Handle = async ({ event, resolve }) => { }; export const themeHook: Handle = async ({ event, resolve }) => { - let theme:String | null = null; + let theme: String | null = null; const newTheme = event.url.searchParams.get("theme"); const cookieTheme = event.cookies.get("colortheme"); - if(newTheme) { + if (newTheme) { theme = newTheme; } else if (cookieTheme) { theme = cookieTheme; @@ -49,25 +49,20 @@ export const themeHook: Handle = async ({ event, resolve }) => { if (theme) { return await resolve(event, { transformPageChunk: ({ html }) => - html.replace('data-theme=""', `data-theme="${theme}"`) - }) + html.replace('data-theme=""', `data-theme="${theme}"`), + }); } return await resolve(event); -} +}; export const setupAdminUser: Handle = async ({ event, resolve }) => { // Check if an admin user exists - /* let result = await db - .select() - .from(userVisitedAdventures) - .where(eq(userVisitedAdventures.userId, event.locals.user.id)) - .execute();*/ let adminUser = await db - .select() - .from(userTable) - .where(eq(userTable.role, 'admin')) - .execute(); + .select() + .from(userTable) + .where(eq(userTable.role, "admin")) + .execute(); // If an admin user exists, return the resolved event if (adminUser != null && adminUser.length > 0) { event.locals.isServerSetup = true; diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index 114db1e..24e5129 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -53,16 +53,6 @@ export const sessionTable = pgTable("session", { }).notNull(), }); -export const userVisitedAdventures = pgTable("userVisitedAdventures", { - adventureID: serial("adventure_id").primaryKey(), - userId: text("user_id") - .notNull() - .references(() => userTable.id), - adventureName: text("adventure_name").notNull(), - location: text("location"), - visitedDate: text("visited_date"), -}); - export const worldTravelCountries = pgTable("worldTravelCountries", { id: serial("id").primaryKey(), name: text("name").notNull(), diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 673d702..5e8b46c 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -32,3 +32,11 @@
+ + + Home | AdventureLog + + diff --git a/src/routes/api/clearvisits/+server.ts b/src/routes/api/clearvisits/+server.ts index 64fed2f..c033943 100644 --- a/src/routes/api/clearvisits/+server.ts +++ b/src/routes/api/clearvisits/+server.ts @@ -1,27 +1,25 @@ import type { RequestEvent } from "@sveltejs/kit"; import { db } from "$lib/db/db.server"; import { eq } from "drizzle-orm"; -import { userVisitedAdventures } from "$lib/db/schema"; +import { adventureTable } from "$lib/db/schema"; export async function DELETE(event: RequestEvent): Promise { - if (!event.locals.user) { - return new Response(JSON.stringify({ error: "No user found" }), { - status: 401, - headers: { - "Content-Type": "application/json", - }, - }); - } - let res = await db - .delete(userVisitedAdventures) - .where( - eq(userVisitedAdventures.userId, event.locals.user.id), - ) - .execute(); - return new Response(JSON.stringify({ res: res }), { - status: 200, + if (!event.locals.user) { + return new Response(JSON.stringify({ error: "No user found" }), { + status: 401, headers: { "Content-Type": "application/json", }, }); - } \ No newline at end of file + } + let res = await db + .delete(adventureTable) + .where(eq(adventureTable.userId, event.locals.user.id)) + .execute(); + return new Response(JSON.stringify({ res: res }), { + status: 200, + headers: { + "Content-Type": "application/json", + }, + }); +} diff --git a/src/routes/api/regionvisit/+server.ts b/src/routes/api/regionvisit/+server.ts index 0c18c19..4d419f9 100644 --- a/src/routes/api/regionvisit/+server.ts +++ b/src/routes/api/regionvisit/+server.ts @@ -1,78 +1,78 @@ import type { RequestEvent } from "@sveltejs/kit"; import { db } from "$lib/db/db.server"; -import { userVisitedAdventures, userVisitedWorldTravel } from "$lib/db/schema"; +import { 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 + 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, - country_code: body.country_code, + userId: event.locals.user.id, + region_id: body.region_id, + country_code: body.country_code, }) .execute(); - return new Response(JSON.stringify({ res: res }), { - status: 200, - headers: { - "Content-Type": "application/json", - }, - }); + 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 + 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", - }, - }); + .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 + 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), - ) + 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 + return new Response(JSON.stringify({ res: res }), { + status: 200, + headers: { + "Content-Type": "application/json", + }, + }); +} diff --git a/src/routes/api/visitcount/+server.ts b/src/routes/api/visitcount/+server.ts index 7d28582..6b2ab1c 100644 --- a/src/routes/api/visitcount/+server.ts +++ b/src/routes/api/visitcount/+server.ts @@ -1,34 +1,34 @@ import type { RequestEvent } from "@sveltejs/kit"; -import { count } from 'drizzle-orm'; +import { count } from "drizzle-orm"; import { eq } from "drizzle-orm"; -import { userVisitedAdventures } from "$lib/db/schema"; +import { adventureTable } from "$lib/db/schema"; import { db } from "$lib/db/db.server"; export async function GET(event: RequestEvent): Promise { - if (!event.locals.user) { - return new Response(JSON.stringify({ error: "No user found" }), { - status: 401, - headers: { - "Content-Type": "application/json", - }, - }); - } - // get the count of the number of adventures the user has visited - let result = await db - .select({ count: count() }) - .from(userVisitedAdventures) - .where(eq(userVisitedAdventures.userId,event.locals.user.id)) - .execute(); + if (!event.locals.user) { + return new Response(JSON.stringify({ error: "No user found" }), { + status: 401, + headers: { + "Content-Type": "application/json", + }, + }); + } + // get the count of the number of adventures the user has visited + let result = await db + .select({ count: count() }) + .from(adventureTable) + .where(eq(adventureTable.userId, event.locals.user.id)) + .execute(); - return new Response( - JSON.stringify({ - visitCount: result[0].count, - }), - { - status: 200, - headers: { - "Content-Type": "application/json", - }, - } - ); - } \ No newline at end of file + return new Response( + JSON.stringify({ + visitCount: result[0].count, + }), + { + status: 200, + headers: { + "Content-Type": "application/json", + }, + } + ); +} diff --git a/src/routes/api/visits/+server.ts b/src/routes/api/visits/+server.ts index bf575de..0350389 100644 --- a/src/routes/api/visits/+server.ts +++ b/src/routes/api/visits/+server.ts @@ -1,6 +1,6 @@ import { lucia } from "$lib/server/auth"; import type { RequestEvent } from "@sveltejs/kit"; -import { adventureTable, userVisitedAdventures } from "$lib/db/schema"; +import { adventureTable } from "$lib/db/schema"; import { db } from "$lib/db/db.server"; import { and, eq } from "drizzle-orm"; import type { Adventure } from "$lib/utils/types"; diff --git a/src/routes/featured/+page.svelte b/src/routes/featured/+page.svelte index dd22129..eb8f6a2 100644 --- a/src/routes/featured/+page.svelte +++ b/src/routes/featured/+page.svelte @@ -11,15 +11,21 @@ }); async function add(event: CustomEvent<{ name: string; location: string }>) { + let newAdventure: Adventure = { + name: event.detail.name, + location: event.detail.location, + date: "", + type: "mylog", + id: -1, + }; + const response = await fetch("/api/visits", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ - name: event.detail.name, - location: event.detail.location, - date: "", + newAdventure, }), }); diff --git a/src/routes/settings/admin/+page.server.ts b/src/routes/settings/admin/+page.server.ts index dd25660..b0bc897 100644 --- a/src/routes/settings/admin/+page.server.ts +++ b/src/routes/settings/admin/+page.server.ts @@ -2,9 +2,9 @@ import { error, redirect, type Actions, type Handle } from "@sveltejs/kit"; import type { PageServerLoad } from "./$types"; import { db } from "$lib/db/db.server"; import { + adventureTable, sessionTable, userTable, - userVisitedAdventures, userVisitedWorldTravel, } from "$lib/db/schema"; import type { DatabaseUser } from "$lib/server/auth"; @@ -25,7 +25,7 @@ export const load: PageServerLoad = async (event) => { users = (await db.select().from(userTable).execute()) as DatabaseUser[]; visitCount = (await db .select({ count: count() }) - .from(userVisitedAdventures) + .from(adventureTable) .execute()) as unknown as number; userCount = (await db .select({ count: count() }) From 9837cc4e64f6497f9a9c9562681b68b12054950e Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 26 Apr 2024 23:09:39 +0000 Subject: [PATCH 11/12] Refactor database schema, remove unused SQL files, and update components --- src/lib/components/AdventureCard.svelte | 141 +++--------------- src/lib/components/Navbar.svelte | 4 - src/routes/planner/+page.server.ts | 21 --- src/routes/planner/+page.svelte | 31 ---- .../worldtravel/[countrycode]/+page.svelte | 4 +- .../[regioncode]/+page.server.ts | 34 ----- .../[countrycode]/[regioncode]/+page.svelte | 88 ----------- 7 files changed, 23 insertions(+), 300 deletions(-) delete mode 100644 src/routes/planner/+page.server.ts delete mode 100644 src/routes/planner/+page.svelte delete mode 100644 src/routes/worldtravel/[countrycode]/[regioncode]/+page.server.ts delete mode 100644 src/routes/worldtravel/[countrycode]/[regioncode]/+page.svelte diff --git a/src/lib/components/AdventureCard.svelte b/src/lib/components/AdventureCard.svelte index 1b2180f..4adc189 100644 --- a/src/lib/components/AdventureCard.svelte +++ b/src/lib/components/AdventureCard.svelte @@ -15,8 +15,6 @@ export let regionId: String | undefined = undefined; export let visited: Boolean | undefined = undefined; export let countryCode: String | undefined = undefined; - export let activityTypes: String[] | undefined = undefined; - export let description: String | undefined = undefined; function remove() { dispatch("remove", id); @@ -41,128 +39,31 @@ } -{#if type === "mylog"} -
-
-

{name}

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

{location}

-
- {/if} - {#if date && date !== ""} -
- -

{date}

-
- {/if} -
+
+
+

{name}

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

{location}

+
+ {/if} + {#if date && date !== ""} +
+ +

{date}

+
+ {/if} +
+ {#if type == "mylog"} -
-
-
-{/if} - -{#if type === "featured"} -
-
-

{name}

- {#if location && location != ""} -
- -

{location}

-
{/if} -
+ {#if type == "featured"} -
-
-
-{/if} - -{#if type === "shared"} -
-
-

{name}

- {#if location && location !== ""} -
- -

{location}

-
- {/if} - {#if date !== ""} -
- -

{date}

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

{name}

-

{regionId}

-
- - {#if !visited} - - {/if} - {#if visited} - - {/if} -
-
-
-{/if} - -{#if type === "planner"} -
-
-

{name}

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

{location}

-
- {/if} - {#if activityTypes && activityTypes.length > 0} - {#each activityTypes as activity} -
- {activity} -
- {/each} - {/if} - {#if description && description.length > 0} -

{description}

- {/if} - {#if date && date != undefined} -
- -

{date}

-
- {/if} -
- -
-
-
-{/if} +
diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index 3f799de..48997b2 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -78,10 +78,6 @@ - {/if} - -
+
+
+ +
+ +
+ +
+ +
+ +
+
+{/if} + +{#if loading} +
+ +
+{/if} Setup | AdventureLog