From 113799261a6085d5cd8aee47485d576d52fc4f4c Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Sat, 1 Jun 2024 18:05:18 +0000 Subject: [PATCH] fix and simplify migration files --- ...ey_iron_monger.sql => 0000_whole_blob.sql} | 21 +- migrations/0001_salty_ser_duncan.sql | 8 - migrations/0002_fine_sabra.sql | 3 - migrations/0003_closed_famine.sql | 1 - migrations/meta/0000_snapshot.json | 68 +-- migrations/meta/0001_snapshot.json | 524 ------------------ migrations/meta/0002_snapshot.json | 489 ---------------- migrations/meta/0003_snapshot.json | 489 ---------------- migrations/meta/_journal.json | 25 +- 9 files changed, 35 insertions(+), 1593 deletions(-) rename migrations/{0000_grey_iron_monger.sql => 0000_whole_blob.sql} (91%) delete mode 100644 migrations/0001_salty_ser_duncan.sql delete mode 100644 migrations/0002_fine_sabra.sql delete mode 100644 migrations/0003_closed_famine.sql delete mode 100644 migrations/meta/0001_snapshot.json delete mode 100644 migrations/meta/0002_snapshot.json delete mode 100644 migrations/meta/0003_snapshot.json diff --git a/migrations/0000_grey_iron_monger.sql b/migrations/0000_whole_blob.sql similarity index 91% rename from migrations/0000_grey_iron_monger.sql rename to migrations/0000_whole_blob.sql index 3b22ce0..19e0ae8 100644 --- a/migrations/0000_grey_iron_monger.sql +++ b/migrations/0000_whole_blob.sql @@ -4,19 +4,13 @@ CREATE TABLE IF NOT EXISTS "adventures" ( "userId" text, "name" text NOT NULL, "location" text, - "activityTypes" json, + "activityTypes" text[] DEFAULT ARRAY[]::text[], "description" text, "rating" integer, "link" text, "imageUrl" text, - "date" text -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "featuredAdventures" ( - "id" serial PRIMARY KEY NOT NULL, - "name" text NOT NULL, - "location" text, - CONSTRAINT "featuredAdventures_name_unique" UNIQUE("name") + "date" text, + "tripId" integer ); --> statement-breakpoint CREATE TABLE IF NOT EXISTS "session" ( @@ -38,8 +32,7 @@ CREATE TABLE IF NOT EXISTS "userPlannedTrips" ( "adventureName" text NOT NULL, "description" text, "startDate" text, - "endDate" text, - "adventures" json + "endDate" text ); --> statement-breakpoint CREATE TABLE IF NOT EXISTS "user" ( @@ -82,6 +75,12 @@ EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "adventures" ADD CONSTRAINT "adventures_tripId_userPlannedTrips_id_fk" FOREIGN KEY ("tripId") REFERENCES "userPlannedTrips"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> 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 diff --git a/migrations/0001_salty_ser_duncan.sql b/migrations/0001_salty_ser_duncan.sql deleted file mode 100644 index dd0edbc..0000000 --- a/migrations/0001_salty_ser_duncan.sql +++ /dev/null @@ -1,8 +0,0 @@ -ALTER TABLE "adventures" ADD COLUMN "tripId" integer;--> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "adventures" ADD CONSTRAINT "adventures_tripId_userPlannedTrips_id_fk" FOREIGN KEY ("tripId") REFERENCES "userPlannedTrips"("id") ON DELETE no action ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -ALTER TABLE "userPlannedTrips" DROP COLUMN IF EXISTS "adventures"; \ No newline at end of file diff --git a/migrations/0002_fine_sabra.sql b/migrations/0002_fine_sabra.sql deleted file mode 100644 index 4dda660..0000000 --- a/migrations/0002_fine_sabra.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE "featuredAdventures";--> statement-breakpoint -ALTER TABLE "adventures" ALTER COLUMN "activityTypes" SET DATA TYPE text[];--> statement-breakpoint -ALTER TABLE "adventures" ALTER COLUMN "activityTypes" SET DEFAULT '{}'::text[]; \ No newline at end of file diff --git a/migrations/0003_closed_famine.sql b/migrations/0003_closed_famine.sql deleted file mode 100644 index f862511..0000000 --- a/migrations/0003_closed_famine.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "adventures" ALTER COLUMN "activityTypes" SET DEFAULT ARRAY[]::text[]; \ No newline at end of file diff --git a/migrations/meta/0000_snapshot.json b/migrations/meta/0000_snapshot.json index c5f36b4..4df7907 100644 --- a/migrations/meta/0000_snapshot.json +++ b/migrations/meta/0000_snapshot.json @@ -1,5 +1,5 @@ { - "id": "7cce94bb-5a17-42ff-850f-e0a41834b739", + "id": "7d9fd5eb-2eed-4595-a3db-6f01cde31041", "prevId": "00000000-0000-0000-0000-000000000000", "version": "5", "dialect": "pg", @@ -40,9 +40,10 @@ }, "activityTypes": { "name": "activityTypes", - "type": "json", + "type": "text[]", "primaryKey": false, - "notNull": false + "notNull": false, + "default": "ARRAY[]::text[]" }, "description": { "name": "description", @@ -73,6 +74,12 @@ "type": "text", "primaryKey": false, "notNull": false + }, + "tripId": { + "name": "tripId", + "type": "integer", + "primaryKey": false, + "notNull": false } }, "indexes": {}, @@ -89,47 +96,24 @@ ], "onDelete": "no action", "onUpdate": "no action" + }, + "adventures_tripId_userPlannedTrips_id_fk": { + "name": "adventures_tripId_userPlannedTrips_id_fk", + "tableFrom": "adventures", + "tableTo": "userPlannedTrips", + "columnsFrom": [ + "tripId" + ], + "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": "", @@ -245,12 +229,6 @@ "type": "text", "primaryKey": false, "notNull": false - }, - "adventures": { - "name": "adventures", - "type": "json", - "primaryKey": false, - "notNull": false } }, "indexes": {}, diff --git a/migrations/meta/0001_snapshot.json b/migrations/meta/0001_snapshot.json deleted file mode 100644 index ed6a851..0000000 --- a/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,524 +0,0 @@ -{ - "id": "7b641b27-ea8e-4786-b130-0c827041d12c", - "prevId": "7cce94bb-5a17-42ff-850f-e0a41834b739", - "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 - }, - "tripId": { - "name": "tripId", - "type": "integer", - "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" - }, - "adventures_tripId_userPlannedTrips_id_fk": { - "name": "adventures_tripId_userPlannedTrips_id_fk", - "tableFrom": "adventures", - "tableTo": "userPlannedTrips", - "columnsFrom": [ - "tripId" - ], - "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": {} - }, - "userPlannedTrips": { - "name": "userPlannedTrips", - "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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "startDate": { - "name": "startDate", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "endDate": { - "name": "endDate", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userPlannedTrips_userId_user_id_fk": { - "name": "userPlannedTrips_userId_user_id_fk", - "tableFrom": "userPlannedTrips", - "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": {} - }, - "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/0002_snapshot.json b/migrations/meta/0002_snapshot.json deleted file mode 100644 index 6a22010..0000000 --- a/migrations/meta/0002_snapshot.json +++ /dev/null @@ -1,489 +0,0 @@ -{ - "id": "7e88cd0d-9f56-418a-9369-b76a55e15ab1", - "prevId": "7b641b27-ea8e-4786-b130-0c827041d12c", - "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": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'::text[]" - }, - "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 - }, - "tripId": { - "name": "tripId", - "type": "integer", - "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" - }, - "adventures_tripId_userPlannedTrips_id_fk": { - "name": "adventures_tripId_userPlannedTrips_id_fk", - "tableFrom": "adventures", - "tableTo": "userPlannedTrips", - "columnsFrom": [ - "tripId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "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": {} - }, - "userPlannedTrips": { - "name": "userPlannedTrips", - "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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "startDate": { - "name": "startDate", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "endDate": { - "name": "endDate", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userPlannedTrips_userId_user_id_fk": { - "name": "userPlannedTrips_userId_user_id_fk", - "tableFrom": "userPlannedTrips", - "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": {} - }, - "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 ac9d76b..0000000 --- a/migrations/meta/0003_snapshot.json +++ /dev/null @@ -1,489 +0,0 @@ -{ - "id": "0c2ad680-0119-47d6-b01b-b411f2286a28", - "prevId": "7e88cd0d-9f56-418a-9369-b76a55e15ab1", - "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": "text[]", - "primaryKey": false, - "notNull": false, - "default": "ARRAY[]::text[]" - }, - "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 - }, - "tripId": { - "name": "tripId", - "type": "integer", - "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" - }, - "adventures_tripId_userPlannedTrips_id_fk": { - "name": "adventures_tripId_userPlannedTrips_id_fk", - "tableFrom": "adventures", - "tableTo": "userPlannedTrips", - "columnsFrom": [ - "tripId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "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": {} - }, - "userPlannedTrips": { - "name": "userPlannedTrips", - "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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "startDate": { - "name": "startDate", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "endDate": { - "name": "endDate", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "userPlannedTrips_userId_user_id_fk": { - "name": "userPlannedTrips_userId_user_id_fk", - "tableFrom": "userPlannedTrips", - "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": {} - }, - "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 4b87401..63abc7e 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -5,29 +5,8 @@ { "idx": 0, "version": "5", - "when": 1715035790035, - "tag": "0000_grey_iron_monger", - "breakpoints": true - }, - { - "idx": 1, - "version": "5", - "when": 1715806684204, - "tag": "0001_salty_ser_duncan", - "breakpoints": true - }, - { - "idx": 2, - "version": "5", - "when": 1717253251149, - "tag": "0002_fine_sabra", - "breakpoints": true - }, - { - "idx": 3, - "version": "5", - "when": 1717253339415, - "tag": "0003_closed_famine", + "when": 1717264326698, + "tag": "0000_whole_blob", "breakpoints": true } ]