diff --git a/migrations/0000_fancy_starjammers.sql b/migrations/0000_fancy_starjammers.sql deleted file mode 100644 index 2f2d3b5..0000000 --- a/migrations/0000_fancy_starjammers.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE IF NOT EXISTS "featuredAdventures" ( - "id" serial PRIMARY KEY NOT NULL, - "name" text NOT NULL, - "location" text -); diff --git a/migrations/0000_panoramic_the_fury.sql b/migrations/0000_panoramic_the_fury.sql new file mode 100644 index 0000000..0a49b25 --- /dev/null +++ b/migrations/0000_panoramic_the_fury.sql @@ -0,0 +1,66 @@ +CREATE TABLE IF NOT EXISTS "featuredAdventures" ( + "id" serial PRIMARY KEY NOT NULL, + "name" text NOT NULL, + "location" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "session" ( + "id" text PRIMARY KEY NOT NULL, + "user_id" text NOT NULL, + "expires_at" timestamp with time zone NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "sharedAdventures" ( + "id" text PRIMARY KEY NOT NULL, + "data" json NOT NULL, + "name" text NOT NULL, + "date" text NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "user" ( + "id" text PRIMARY KEY NOT NULL, + "username" text NOT NULL, + "first_name" text NOT NULL, + "last_name" text NOT NULL, + "icon" text, + "hashed_password" varchar NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "userVisitedAdventures" ( + "adventure_id" serial PRIMARY KEY NOT NULL, + "user_id" text NOT NULL, + "adventure_name" text NOT NULL, + "location" text, + "visited_date" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "worldTravelCountries" ( + "id" serial PRIMARY KEY NOT NULL, + "name" text NOT NULL, + "country_code" text NOT NULL, + "continent" text NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "worldTravelRegions" ( + "id" serial PRIMARY KEY NOT NULL, + "name" text NOT NULL, + "country_id" text NOT NULL +); +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "userVisitedAdventures" ADD CONSTRAINT "userVisitedAdventures_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "worldTravelRegions" ADD CONSTRAINT "worldTravelRegions_country_id_worldTravelCountries_id_fk" FOREIGN KEY ("country_id") REFERENCES "worldTravelCountries"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/migrations/0001_nostalgic_skreet.sql b/migrations/0001_nostalgic_skreet.sql deleted file mode 100644 index cf21484..0000000 --- a/migrations/0001_nostalgic_skreet.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE IF NOT EXISTS "sharedAdventures" ( - "id" serial PRIMARY KEY NOT NULL, - "name" text NOT NULL, - "location" text, - "date" text -); diff --git a/migrations/0001_smart_cargill.sql b/migrations/0001_smart_cargill.sql new file mode 100644 index 0000000..4c29cad --- /dev/null +++ b/migrations/0001_smart_cargill.sql @@ -0,0 +1 @@ +DROP TABLE "worldTravelRegions"; \ No newline at end of file diff --git a/migrations/0002_dusty_captain_midlands.sql b/migrations/0002_dusty_captain_midlands.sql deleted file mode 100644 index 5945004..0000000 --- a/migrations/0002_dusty_captain_midlands.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "sharedAdventures" ALTER COLUMN "id" SET DATA TYPE text; \ No newline at end of file diff --git a/migrations/0002_glamorous_junta.sql b/migrations/0002_glamorous_junta.sql new file mode 100644 index 0000000..18653c4 --- /dev/null +++ b/migrations/0002_glamorous_junta.sql @@ -0,0 +1,11 @@ +CREATE TABLE IF NOT EXISTS "worldTravelRegions" ( + "id" serial PRIMARY KEY NOT NULL, + "name" text NOT NULL, + "country_id" text NOT NULL +); +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "worldTravelRegions" ADD CONSTRAINT "worldTravelRegions_country_id_worldTravelCountries_id_fk" FOREIGN KEY ("country_id") REFERENCES "worldTravelCountries"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/migrations/0003_clammy_goblin_queen.sql b/migrations/0003_clammy_goblin_queen.sql deleted file mode 100644 index ada8daf..0000000 --- a/migrations/0003_clammy_goblin_queen.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE "sharedAdventures" ADD COLUMN "data" json NOT NULL;--> statement-breakpoint -ALTER TABLE "sharedAdventures" DROP COLUMN IF EXISTS "name";--> statement-breakpoint -ALTER TABLE "sharedAdventures" DROP COLUMN IF EXISTS "location";--> statement-breakpoint -ALTER TABLE "sharedAdventures" DROP COLUMN IF EXISTS "date"; \ No newline at end of file diff --git a/migrations/0003_nasty_onslaught.sql b/migrations/0003_nasty_onslaught.sql new file mode 100644 index 0000000..e9faf11 --- /dev/null +++ b/migrations/0003_nasty_onslaught.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelRegions" ALTER COLUMN "country_id" SET DATA TYPE serial; \ No newline at end of file diff --git a/migrations/0004_short_luke_cage.sql b/migrations/0004_short_luke_cage.sql new file mode 100644 index 0000000..4e6e152 --- /dev/null +++ b/migrations/0004_short_luke_cage.sql @@ -0,0 +1,2 @@ +ALTER TABLE "worldTravelRegions" ALTER COLUMN "id" SET DATA TYPE text;--> statement-breakpoint +ALTER TABLE "worldTravelRegions" ALTER COLUMN "country_id" SET DATA TYPE text; \ No newline at end of file diff --git a/migrations/0004_smart_maelstrom.sql b/migrations/0004_smart_maelstrom.sql deleted file mode 100644 index 5982edc..0000000 --- a/migrations/0004_smart_maelstrom.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE IF NOT EXISTS "session" ( - "id" text PRIMARY KEY NOT NULL, - "user_id" text NOT NULL, - "expires_at" timestamp with time zone NOT NULL -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "user" ( - "id" text PRIMARY KEY NOT NULL -); ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; diff --git a/migrations/0005_glamorous_pixie.sql b/migrations/0005_glamorous_pixie.sql deleted file mode 100644 index c50335d..0000000 --- a/migrations/0005_glamorous_pixie.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "user" ADD COLUMN "username" text NOT NULL;--> statement-breakpoint -ALTER TABLE "user" ADD COLUMN "hashed_password" text NOT NULL; \ No newline at end of file diff --git a/migrations/0005_nervous_krista_starr.sql b/migrations/0005_nervous_krista_starr.sql new file mode 100644 index 0000000..1cd4bab --- /dev/null +++ b/migrations/0005_nervous_krista_starr.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelRegions" ALTER COLUMN "country_id" SET DATA TYPE integer; \ No newline at end of file diff --git a/migrations/0006_fuzzy_gamma_corps.sql b/migrations/0006_fuzzy_gamma_corps.sql new file mode 100644 index 0000000..47b3cec --- /dev/null +++ b/migrations/0006_fuzzy_gamma_corps.sql @@ -0,0 +1 @@ +ALTER TABLE "worldTravelRegions" ALTER COLUMN "id" SET DATA TYPE serial; \ No newline at end of file diff --git a/migrations/0006_melted_leech.sql b/migrations/0006_melted_leech.sql deleted file mode 100644 index 202d31b..0000000 --- a/migrations/0006_melted_leech.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "user" ALTER COLUMN "hashed_password" SET DATA TYPE varchar; \ No newline at end of file diff --git a/migrations/0007_nervous_scalphunter.sql b/migrations/0007_nervous_scalphunter.sql deleted file mode 100644 index baf412d..0000000 --- a/migrations/0007_nervous_scalphunter.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "user" ADD COLUMN "first_name" text NOT NULL;--> statement-breakpoint -ALTER TABLE "user" ADD COLUMN "last_name" text NOT NULL; \ No newline at end of file diff --git a/migrations/0007_youthful_shiver_man.sql b/migrations/0007_youthful_shiver_man.sql new file mode 100644 index 0000000..4c29cad --- /dev/null +++ b/migrations/0007_youthful_shiver_man.sql @@ -0,0 +1 @@ +DROP TABLE "worldTravelRegions"; \ No newline at end of file diff --git a/migrations/0008_romantic_maria_hill.sql b/migrations/0008_romantic_maria_hill.sql deleted file mode 100644 index da68456..0000000 --- a/migrations/0008_romantic_maria_hill.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE IF NOT EXISTS "userVisitedAdventures" ( - "user_id" text NOT NULL, - "adventure_name" text NOT NULL, - "location" text, - "adventure_visited" text -); ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "userVisitedAdventures" ADD CONSTRAINT "userVisitedAdventures_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; diff --git a/migrations/0009_spotty_madame_web.sql b/migrations/0009_spotty_madame_web.sql deleted file mode 100644 index 900b8d7..0000000 --- a/migrations/0009_spotty_madame_web.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE "userVisitedAdventures" RENAME COLUMN "adventure_visited" TO "adventure_id";--> statement-breakpoint -ALTER TABLE "userVisitedAdventures" ADD PRIMARY KEY ("adventure_id");--> statement-breakpoint -ALTER TABLE "userVisitedAdventures" ALTER COLUMN "adventure_id" SET DATA TYPE serial;--> statement-breakpoint -ALTER TABLE "userVisitedAdventures" ALTER COLUMN "adventure_id" SET NOT NULL;--> statement-breakpoint -ALTER TABLE "userVisitedAdventures" ADD COLUMN "visited_date" text; \ No newline at end of file diff --git a/migrations/0010_lean_gamma_corps.sql b/migrations/0010_lean_gamma_corps.sql deleted file mode 100644 index 81eb4e1..0000000 --- a/migrations/0010_lean_gamma_corps.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "user" ADD COLUMN "icon" text; \ No newline at end of file diff --git a/migrations/0011_heavy_ben_urich.sql b/migrations/0011_heavy_ben_urich.sql deleted file mode 100644 index 6f47f52..0000000 --- a/migrations/0011_heavy_ben_urich.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "sharedAdventures" ADD COLUMN "name" text NOT NULL;--> statement-breakpoint -ALTER TABLE "sharedAdventures" ADD COLUMN "date" text NOT NULL; \ No newline at end of file diff --git a/migrations/meta/0000_snapshot.json b/migrations/meta/0000_snapshot.json index 5700d27..ecf5508 100644 --- a/migrations/meta/0000_snapshot.json +++ b/migrations/meta/0000_snapshot.json @@ -1,5 +1,5 @@ { - "id": "1639b320-88dd-4af5-ae34-092ab26b4b85", + "id": "9341b0b9-3e38-4043-bc4e-5655d8f0a953", "prevId": "00000000-0000-0000-0000-000000000000", "version": "5", "dialect": "pg", @@ -31,6 +31,258 @@ "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {} + }, + "session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "sharedAdventures": { + "name": "sharedAdventures", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "data": { + "name": "data", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hashed_password": { + "name": "hashed_password", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "userVisitedAdventures": { + "name": "userVisitedAdventures", + "schema": "", + "columns": { + "adventure_id": { + "name": "adventure_id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventure_name": { + "name": "adventure_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visited_date": { + "name": "visited_date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userVisitedAdventures_user_id_user_id_fk": { + "name": "userVisitedAdventures_user_id_user_id_fk", + "tableFrom": "userVisitedAdventures", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelCountries": { + "name": "worldTravelCountries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "continent": { + "name": "continent", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelRegions": { + "name": "worldTravelRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_id": { + "name": "country_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelRegions_country_id_worldTravelCountries_id_fk": { + "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", + "tableFrom": "worldTravelRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0001_snapshot.json b/migrations/meta/0001_snapshot.json index bbdf8d5..862a31e 100644 --- a/migrations/meta/0001_snapshot.json +++ b/migrations/meta/0001_snapshot.json @@ -1,6 +1,6 @@ { - "id": "183ebfda-8d83-4256-8715-169d36867deb", - "prevId": "1639b320-88dd-4af5-ae34-092ab26b4b85", + "id": "125fff71-fcac-407b-b811-cdc6cf7931b0", + "prevId": "9341b0b9-3e38-4043-bc4e-5655d8f0a953", "version": "5", "dialect": "pg", "tables": { @@ -32,9 +32,185 @@ "compositePrimaryKeys": {}, "uniqueConstraints": {} }, + "session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, "sharedAdventures": { "name": "sharedAdventures", "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "data": { + "name": "data", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hashed_password": { + "name": "hashed_password", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "userVisitedAdventures": { + "name": "userVisitedAdventures", + "schema": "", + "columns": { + "adventure_id": { + "name": "adventure_id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventure_name": { + "name": "adventure_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visited_date": { + "name": "visited_date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userVisitedAdventures_user_id_user_id_fk": { + "name": "userVisitedAdventures_user_id_user_id_fk", + "tableFrom": "userVisitedAdventures", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelCountries": { + "name": "worldTravelCountries", + "schema": "", "columns": { "id": { "name": "id", @@ -48,17 +224,17 @@ "primaryKey": false, "notNull": true }, - "location": { - "name": "location", + "country_code": { + "name": "country_code", "type": "text", "primaryKey": false, - "notNull": false + "notNull": true }, - "date": { - "name": "date", + "continent": { + "name": "continent", "type": "text", "primaryKey": false, - "notNull": false + "notNull": true } }, "indexes": {}, diff --git a/migrations/meta/0002_snapshot.json b/migrations/meta/0002_snapshot.json index 7be23f6..054374a 100644 --- a/migrations/meta/0002_snapshot.json +++ b/migrations/meta/0002_snapshot.json @@ -1,6 +1,6 @@ { - "id": "808d6d31-5ef6-4b22-97f0-cfc73193eb5e", - "prevId": "183ebfda-8d83-4256-8715-169d36867deb", + "id": "88f059b3-b83f-4031-b2f1-89401d74ad1b", + "prevId": "125fff71-fcac-407b-b811-cdc6cf7931b0", "version": "5", "dialect": "pg", "tables": { @@ -32,6 +32,48 @@ "compositePrimaryKeys": {}, "uniqueConstraints": {} }, + "session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, "sharedAdventures": { "name": "sharedAdventures", "schema": "", @@ -42,29 +84,205 @@ "primaryKey": true, "notNull": true }, + "data": { + "name": "data", + "type": "json", + "primaryKey": false, + "notNull": true + }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hashed_password": { + "name": "hashed_password", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "userVisitedAdventures": { + "name": "userVisitedAdventures", + "schema": "", + "columns": { + "adventure_id": { + "name": "adventure_id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventure_name": { + "name": "adventure_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, "location": { "name": "location", "type": "text", "primaryKey": false, "notNull": false }, - "date": { - "name": "date", + "visited_date": { + "name": "visited_date", "type": "text", "primaryKey": false, "notNull": false } }, "indexes": {}, + "foreignKeys": { + "userVisitedAdventures_user_id_user_id_fk": { + "name": "userVisitedAdventures_user_id_user_id_fk", + "tableFrom": "userVisitedAdventures", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelCountries": { + "name": "worldTravelCountries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "continent": { + "name": "continent", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {} + }, + "worldTravelRegions": { + "name": "worldTravelRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_id": { + "name": "country_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelRegions_country_id_worldTravelCountries_id_fk": { + "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", + "tableFrom": "worldTravelRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0003_snapshot.json b/migrations/meta/0003_snapshot.json index f8fd8c1..0b80ab5 100644 --- a/migrations/meta/0003_snapshot.json +++ b/migrations/meta/0003_snapshot.json @@ -1,6 +1,6 @@ { - "id": "45d98527-f0a9-44fc-9658-d3c461afed95", - "prevId": "808d6d31-5ef6-4b22-97f0-cfc73193eb5e", + "id": "e6295a91-815f-4f5e-8e1c-f83901c9b8d1", + "prevId": "88f059b3-b83f-4031-b2f1-89401d74ad1b", "version": "5", "dialect": "pg", "tables": { @@ -32,6 +32,48 @@ "compositePrimaryKeys": {}, "uniqueConstraints": {} }, + "session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, "sharedAdventures": { "name": "sharedAdventures", "schema": "", @@ -47,12 +89,200 @@ "type": "json", "primaryKey": false, "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {} + }, + "user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hashed_password": { + "name": "hashed_password", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "userVisitedAdventures": { + "name": "userVisitedAdventures", + "schema": "", + "columns": { + "adventure_id": { + "name": "adventure_id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventure_name": { + "name": "adventure_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visited_date": { + "name": "visited_date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userVisitedAdventures_user_id_user_id_fk": { + "name": "userVisitedAdventures_user_id_user_id_fk", + "tableFrom": "userVisitedAdventures", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelCountries": { + "name": "worldTravelCountries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "continent": { + "name": "continent", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelRegions": { + "name": "worldTravelRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_id": { + "name": "country_id", + "type": "serial", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelRegions_country_id_worldTravelCountries_id_fk": { + "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", + "tableFrom": "worldTravelRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0004_snapshot.json b/migrations/meta/0004_snapshot.json index 9d59b97..a895a77 100644 --- a/migrations/meta/0004_snapshot.json +++ b/migrations/meta/0004_snapshot.json @@ -1,6 +1,6 @@ { - "id": "ccf7c336-c61f-452f-822b-b3b039bb20f9", - "prevId": "45d98527-f0a9-44fc-9658-d3c461afed95", + "id": "ca4d65ff-ab48-476d-8494-27a21ac0fcf4", + "prevId": "e6295a91-815f-4f5e-8e1c-f83901c9b8d1", "version": "5", "dialect": "pg", "tables": { @@ -89,6 +89,18 @@ "type": "json", "primaryKey": false, "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true } }, "indexes": {}, @@ -105,12 +117,172 @@ "type": "text", "primaryKey": true, "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hashed_password": { + "name": "hashed_password", + "type": "varchar", + "primaryKey": false, + "notNull": true } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {} + }, + "userVisitedAdventures": { + "name": "userVisitedAdventures", + "schema": "", + "columns": { + "adventure_id": { + "name": "adventure_id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventure_name": { + "name": "adventure_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visited_date": { + "name": "visited_date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userVisitedAdventures_user_id_user_id_fk": { + "name": "userVisitedAdventures_user_id_user_id_fk", + "tableFrom": "userVisitedAdventures", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelCountries": { + "name": "worldTravelCountries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "continent": { + "name": "continent", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelRegions": { + "name": "worldTravelRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_id": { + "name": "country_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelRegions_country_id_worldTravelCountries_id_fk": { + "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", + "tableFrom": "worldTravelRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0005_snapshot.json b/migrations/meta/0005_snapshot.json index 116f836..b301016 100644 --- a/migrations/meta/0005_snapshot.json +++ b/migrations/meta/0005_snapshot.json @@ -1,6 +1,6 @@ { - "id": "e91dda33-e04e-4e99-a297-21a34aa35493", - "prevId": "ccf7c336-c61f-452f-822b-b3b039bb20f9", + "id": "f19bd92c-115d-4f2e-a3be-31ece1ba07b0", + "prevId": "ca4d65ff-ab48-476d-8494-27a21ac0fcf4", "version": "5", "dialect": "pg", "tables": { @@ -89,6 +89,18 @@ "type": "json", "primaryKey": false, "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true } }, "indexes": {}, @@ -112,8 +124,114 @@ "primaryKey": false, "notNull": true }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, "hashed_password": { "name": "hashed_password", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "userVisitedAdventures": { + "name": "userVisitedAdventures", + "schema": "", + "columns": { + "adventure_id": { + "name": "adventure_id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventure_name": { + "name": "adventure_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visited_date": { + "name": "visited_date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userVisitedAdventures_user_id_user_id_fk": { + "name": "userVisitedAdventures_user_id_user_id_fk", + "tableFrom": "userVisitedAdventures", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelCountries": { + "name": "worldTravelCountries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "continent": { + "name": "continent", "type": "text", "primaryKey": false, "notNull": true @@ -123,6 +241,48 @@ "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {} + }, + "worldTravelRegions": { + "name": "worldTravelRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_id": { + "name": "country_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelRegions_country_id_worldTravelCountries_id_fk": { + "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", + "tableFrom": "worldTravelRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0006_snapshot.json b/migrations/meta/0006_snapshot.json index 2b36a76..447088a 100644 --- a/migrations/meta/0006_snapshot.json +++ b/migrations/meta/0006_snapshot.json @@ -1,6 +1,6 @@ { - "id": "b0849b3e-02e1-42e1-b07c-6fa613c98e82", - "prevId": "e91dda33-e04e-4e99-a297-21a34aa35493", + "id": "1cfee0e3-3270-431c-9045-4938e0d02935", + "prevId": "f19bd92c-115d-4f2e-a3be-31ece1ba07b0", "version": "5", "dialect": "pg", "tables": { @@ -89,6 +89,18 @@ "type": "json", "primaryKey": false, "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true } }, "indexes": {}, @@ -112,6 +124,24 @@ "primaryKey": false, "notNull": true }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, "hashed_password": { "name": "hashed_password", "type": "varchar", @@ -123,6 +153,136 @@ "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {} + }, + "userVisitedAdventures": { + "name": "userVisitedAdventures", + "schema": "", + "columns": { + "adventure_id": { + "name": "adventure_id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventure_name": { + "name": "adventure_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visited_date": { + "name": "visited_date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userVisitedAdventures_user_id_user_id_fk": { + "name": "userVisitedAdventures_user_id_user_id_fk", + "tableFrom": "userVisitedAdventures", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelCountries": { + "name": "worldTravelCountries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "continent": { + "name": "continent", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelRegions": { + "name": "worldTravelRegions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_id": { + "name": "country_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "worldTravelRegions_country_id_worldTravelCountries_id_fk": { + "name": "worldTravelRegions_country_id_worldTravelCountries_id_fk", + "tableFrom": "worldTravelRegions", + "tableTo": "worldTravelCountries", + "columnsFrom": [ + "country_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0007_snapshot.json b/migrations/meta/0007_snapshot.json index e436475..4c284d4 100644 --- a/migrations/meta/0007_snapshot.json +++ b/migrations/meta/0007_snapshot.json @@ -1,6 +1,6 @@ { - "id": "2039600b-1f5f-4f37-84dd-bb40636855e7", - "prevId": "b0849b3e-02e1-42e1-b07c-6fa613c98e82", + "id": "d395e6d3-0873-4815-8875-f1c2ce0c3571", + "prevId": "1cfee0e3-3270-431c-9045-4938e0d02935", "version": "5", "dialect": "pg", "tables": { @@ -89,6 +89,18 @@ "type": "json", "primaryKey": false, "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true } }, "indexes": {}, @@ -124,6 +136,12 @@ "primaryKey": false, "notNull": true }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, "hashed_password": { "name": "hashed_password", "type": "varchar", @@ -135,6 +153,94 @@ "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {} + }, + "userVisitedAdventures": { + "name": "userVisitedAdventures", + "schema": "", + "columns": { + "adventure_id": { + "name": "adventure_id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "adventure_name": { + "name": "adventure_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visited_date": { + "name": "visited_date", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "userVisitedAdventures_user_id_user_id_fk": { + "name": "userVisitedAdventures_user_id_user_id_fk", + "tableFrom": "userVisitedAdventures", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "worldTravelCountries": { + "name": "worldTravelCountries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "continent": { + "name": "continent", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} } }, "enums": {}, diff --git a/migrations/meta/0008_snapshot.json b/migrations/meta/0008_snapshot.json deleted file mode 100644 index 1580c9e..0000000 --- a/migrations/meta/0008_snapshot.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "id": "ec5af5e4-8522-4383-af47-412fb43c7cc3", - "prevId": "2039600b-1f5f-4f37-84dd-bb40636855e7", - "version": "5", - "dialect": "pg", - "tables": { - "featuredAdventures": { - "name": "featuredAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "sharedAdventures": { - "name": "sharedAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "data": { - "name": "data", - "type": "json", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "username": { - "name": "username", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "first_name": { - "name": "first_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_name": { - "name": "last_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "hashed_password": { - "name": "hashed_password", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "userVisitedAdventures": { - "name": "userVisitedAdventures", - "schema": "", - "columns": { - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "adventure_name": { - "name": "adventure_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "adventure_visited": { - "name": "adventure_visited", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userVisitedAdventures_user_id_user_id_fk": { - "name": "userVisitedAdventures_user_id_user_id_fk", - "tableFrom": "userVisitedAdventures", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0009_snapshot.json b/migrations/meta/0009_snapshot.json deleted file mode 100644 index 46e2615..0000000 --- a/migrations/meta/0009_snapshot.json +++ /dev/null @@ -1,201 +0,0 @@ -{ - "id": "1d83805d-6ee2-4dae-87a6-5af6f2d5add3", - "prevId": "ec5af5e4-8522-4383-af47-412fb43c7cc3", - "version": "5", - "dialect": "pg", - "tables": { - "featuredAdventures": { - "name": "featuredAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "sharedAdventures": { - "name": "sharedAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "data": { - "name": "data", - "type": "json", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "username": { - "name": "username", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "first_name": { - "name": "first_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_name": { - "name": "last_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "hashed_password": { - "name": "hashed_password", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "userVisitedAdventures": { - "name": "userVisitedAdventures", - "schema": "", - "columns": { - "adventure_id": { - "name": "adventure_id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "adventure_name": { - "name": "adventure_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "visited_date": { - "name": "visited_date", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userVisitedAdventures_user_id_user_id_fk": { - "name": "userVisitedAdventures_user_id_user_id_fk", - "tableFrom": "userVisitedAdventures", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0010_snapshot.json b/migrations/meta/0010_snapshot.json deleted file mode 100644 index a5a5fdd..0000000 --- a/migrations/meta/0010_snapshot.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "id": "d6cd08c8-9dc8-42df-aab9-0f5800602864", - "prevId": "1d83805d-6ee2-4dae-87a6-5af6f2d5add3", - "version": "5", - "dialect": "pg", - "tables": { - "featuredAdventures": { - "name": "featuredAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "sharedAdventures": { - "name": "sharedAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "data": { - "name": "data", - "type": "json", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "username": { - "name": "username", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "first_name": { - "name": "first_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_name": { - "name": "last_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "icon": { - "name": "icon", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "hashed_password": { - "name": "hashed_password", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "userVisitedAdventures": { - "name": "userVisitedAdventures", - "schema": "", - "columns": { - "adventure_id": { - "name": "adventure_id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "adventure_name": { - "name": "adventure_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "visited_date": { - "name": "visited_date", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userVisitedAdventures_user_id_user_id_fk": { - "name": "userVisitedAdventures_user_id_user_id_fk", - "tableFrom": "userVisitedAdventures", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/0011_snapshot.json b/migrations/meta/0011_snapshot.json deleted file mode 100644 index 5b38d4a..0000000 --- a/migrations/meta/0011_snapshot.json +++ /dev/null @@ -1,219 +0,0 @@ -{ - "id": "b318f7a7-c4e1-49f3-9bfc-7d68f118bf7d", - "prevId": "d6cd08c8-9dc8-42df-aab9-0f5800602864", - "version": "5", - "dialect": "pg", - "tables": { - "featuredAdventures": { - "name": "featuredAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "sharedAdventures": { - "name": "sharedAdventures", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "data": { - "name": "data", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "username": { - "name": "username", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "first_name": { - "name": "first_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_name": { - "name": "last_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "icon": { - "name": "icon", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "hashed_password": { - "name": "hashed_password", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "userVisitedAdventures": { - "name": "userVisitedAdventures", - "schema": "", - "columns": { - "adventure_id": { - "name": "adventure_id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "adventure_name": { - "name": "adventure_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "visited_date": { - "name": "visited_date", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userVisitedAdventures_user_id_user_id_fk": { - "name": "userVisitedAdventures_user_id_user_id_fk", - "tableFrom": "userVisitedAdventures", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/migrations/meta/_journal.json b/migrations/meta/_journal.json index ef98192..06225fe 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -5,85 +5,57 @@ { "idx": 0, "version": "5", - "when": 1712061709595, - "tag": "0000_fancy_starjammers", + "when": 1712879281600, + "tag": "0000_panoramic_the_fury", "breakpoints": true }, { "idx": 1, "version": "5", - "when": 1712083579596, - "tag": "0001_nostalgic_skreet", + "when": 1712879301598, + "tag": "0001_smart_cargill", "breakpoints": true }, { "idx": 2, "version": "5", - "when": 1712083756923, - "tag": "0002_dusty_captain_midlands", + "when": 1712879457439, + "tag": "0002_glamorous_junta", "breakpoints": true }, { "idx": 3, "version": "5", - "when": 1712083977580, - "tag": "0003_clammy_goblin_queen", + "when": 1712879488661, + "tag": "0003_nasty_onslaught", "breakpoints": true }, { "idx": 4, "version": "5", - "when": 1712103855532, - "tag": "0004_smart_maelstrom", + "when": 1712879540659, + "tag": "0004_short_luke_cage", "breakpoints": true }, { "idx": 5, "version": "5", - "when": 1712104331399, - "tag": "0005_glamorous_pixie", + "when": 1712879605930, + "tag": "0005_nervous_krista_starr", "breakpoints": true }, { "idx": 6, "version": "5", - "when": 1712105206127, - "tag": "0006_melted_leech", + "when": 1712879813045, + "tag": "0006_fuzzy_gamma_corps", "breakpoints": true }, { "idx": 7, "version": "5", - "when": 1712167204757, - "tag": "0007_nervous_scalphunter", - "breakpoints": true - }, - { - "idx": 8, - "version": "5", - "when": 1712186591227, - "tag": "0008_romantic_maria_hill", - "breakpoints": true - }, - { - "idx": 9, - "version": "5", - "when": 1712407140727, - "tag": "0009_spotty_madame_web", - "breakpoints": true - }, - { - "idx": 10, - "version": "5", - "when": 1712842196443, - "tag": "0010_lean_gamma_corps", - "breakpoints": true - }, - { - "idx": 11, - "version": "5", - "when": 1712873663208, - "tag": "0011_heavy_ben_urich", + "when": 1712879875868, + "tag": "0007_youthful_shiver_man", "breakpoints": true } ] diff --git a/sql/countries.sql b/sql/countries.sql new file mode 100644 index 0000000..adfc955 --- /dev/null +++ b/sql/countries.sql @@ -0,0 +1,17 @@ +INSERT INTO "worldTravelCountries" (name, country_code, continent) +VALUES + ('United States', 'us', 'North America'), + ('Canada', 'ca', 'North America'), + ('Mexico', 'mx', 'North America'), + ('Brazil', 'br', 'South America'), + ('Argentina', 'ar', 'South America'), + ('United Kingdom', 'gb', 'Europe'), + ('Germany', 'de', 'Europe'), + ('France', 'fr', 'Europe'), + ('Japan', 'jp', 'Asia'), + ('China', 'cn', 'Asia'), + ('India', 'in', 'Asia'), + ('Australia', 'au', 'Oceania'), + ('New Zealand', 'nz', 'Oceania'), + ('South Africa', 'za', 'Africa'), + ('Egypt', 'eg', 'Africa'); diff --git a/sql/parks.sql b/sql/parks.sql index 207813c..701017d 100644 --- a/sql/parks.sql +++ b/sql/parks.sql @@ -79,3 +79,4 @@ INSERT INTO "featuredAdventures" (id, name, location) VALUES (97, 'Acadia National Park', 'Maine, USA'), (98, 'Sequoia National Park', 'California, USA'), (99, 'Joshua Tree National Park', 'California, USA'); +ON CONFLICT (id) DO NOTHING; \ No newline at end of file diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index 5df214e..acd2e55 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -5,6 +5,8 @@ import { json, serial, varchar, + foreignKey, + integer, } from "drizzle-orm/pg-core"; export const featuredAdventures = pgTable("featuredAdventures", { @@ -51,3 +53,10 @@ export const userVisitedAdventures = pgTable("userVisitedAdventures", { location: text("location"), visitedDate: text("visited_date"), }); + +export const worldTravelCountries = pgTable("worldTravelCountries", { + id: serial("id").primaryKey(), + name: text("name").notNull(), + country_code: text("country_code").notNull(), + continent: text("continent").notNull(), +}); diff --git a/src/routes/worldtravel/+page.server.ts b/src/routes/worldtravel/+page.server.ts new file mode 100644 index 0000000..dfe39b9 --- /dev/null +++ b/src/routes/worldtravel/+page.server.ts @@ -0,0 +1,19 @@ +import { redirect } from "@sveltejs/kit"; +import type { PageServerLoad } from "./$types"; +import type { Adventure } from "$lib/utils/types"; +import { db } from "$lib/db/db.server"; +import { worldTravelCountries } from "$lib/db/schema"; + +export const load: PageServerLoad = async (event) => { + if (!event.locals.user) { + return redirect(302, "/login"); + } + let response = await db + .select() + .from(worldTravelCountries) + + // let array = result.adventures as Adventure[]; + return { + response, + }; +}; diff --git a/src/routes/worldtravel/+page.svelte b/src/routes/worldtravel/+page.svelte new file mode 100644 index 0000000..8bf0b29 --- /dev/null +++ b/src/routes/worldtravel/+page.svelte @@ -0,0 +1,20 @@ + + +