diff --git a/drizzle/0001_heavy_molten_man.sql b/drizzle/0001_heavy_molten_man.sql new file mode 100644 index 0000000..af2bef2 --- /dev/null +++ b/drizzle/0001_heavy_molten_man.sql @@ -0,0 +1,353 @@ +DO $$ BEGIN + CREATE TYPE "public"."allowedAccess" AS ENUM('public', 'permissive', 'customers', 'permit', 'private', 'mixed'); +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + CREATE TYPE "public"."amountOfPeople" AS ENUM('none', 'few', 'some', 'many', 'crowded'); +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + CREATE TYPE "public"."difficulty" AS ENUM('accessible', 'normal', 'smallEffort', 'hard', 'dangerous'); +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + CREATE TYPE "public"."groundType" AS ENUM('sand', 'pebbles', 'rocks', 'concrete', 'dirt', 'pavimented'); +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + CREATE TYPE "public"."howNarrow" AS ENUM('extremlyNarrow', 'narrow', 'extraSpace', 'wide', 'veryWide'); +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + CREATE TYPE "public"."placeToArriveFrom" AS ENUM('townCenter', 'parking', 'beach', 'road'); +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + CREATE TYPE "public"."priceUnit" AS ENUM('eur', 'eur/minute', 'eur/hour', 'eur/day'); +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + CREATE TYPE "public"."scubaDivingLevel" AS ENUM('discoverScubaDiving', 'openWater', 'advancedOpenWater', 'specialtyDiver', 'technicalDiver'); +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + CREATE TYPE "public"."trainingLevel" AS ENUM('noTraining', 'amateur', 'entryLevel', 'advanced', 'professional', 'elite'); +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + CREATE TYPE "public"."gender" AS ENUM('masculine', 'feminine'); +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "account" ( + "userId" text NOT NULL, + "type" text NOT NULL, + "provider" text NOT NULL, + "providerAccountId" text NOT NULL, + "refresh_token" text, + "access_token" text, + "expires_at" integer, + "token_type" text, + "scope" text, + "id_token" text, + "session_state" text, + CONSTRAINT "account_provider_providerAccountId_pk" PRIMARY KEY("provider","providerAccountId") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "session" ( + "sessionToken" text PRIMARY KEY NOT NULL, + "userId" text NOT NULL, + "expires" timestamp NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "verificationToken" ( + "identifier" text NOT NULL, + "token" text NOT NULL, + "expires" timestamp NOT NULL, + CONSTRAINT "verificationToken_identifier_token_pk" PRIMARY KEY("identifier","token") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "externalLink" ( + "id" serial PRIMARY KEY NOT NULL, + "placeId" integer, + "routeId" integer, + "isOfficialWebsite" boolean, + "url" text NOT NULL, + "title" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "externalLink_translation" ( + "id" serial PRIMARY KEY NOT NULL, + "externalLink_id" integer NOT NULL, + "locale" varchar(10) NOT NULL, + "url" text NOT NULL, + "title" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "feature" ( + "id" serial PRIMARY KEY NOT NULL, + "amountOfPeople" "amountOfPeople", + "difficulty" "difficulty", + "groundType" "groundType", + "hasBus" boolean, + "hasParking" boolean, + "parkingSpaces" integer, + "hasToilet" boolean, + "hasRestaurant" boolean, + "hasDrinkingWater" boolean, + "hasShower" boolean, + "hasLifeguard" boolean, + "hasLeisure" boolean, + "isNudist" boolean, + "hasUnofficialName" boolean, + "hasInacurateLocation" boolean, + "date" text, + "isBoatOnly" boolean, + "trainingLevel" "trainingLevel", + "hasMissingInfo" boolean, + "height" integer, + "depth" integer, + "depthMin" integer, + "depthMax" integer, + "scubaDivingLevel" "scubaDivingLevel", + "notThereAnymore" boolean, + "isOutOfTheMunicipality" boolean, + "hasBench" boolean, + "allowedAccess" "allowedAccess", + "dimensions" text, + "price" double precision, + "priceUnit" "priceUnit", + "isCovered" boolean, + "duration" integer, + "distance" integer, + "slope" integer, + "timeToArrive" integer, + "placeToArriveFrom" "placeToArriveFrom", + "isFreeWithLocalStamp" boolean, + "howNarrow" "howNarrow", + "difficultyNotes" text, + "priceNotes" text, + "allowedAccessNotes" text, + "hasInacurateLocationNotes" text, + "hasMissingInfoNotes" text, + "notThereAnymoreNotes" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "feature_translation" ( + "id" serial PRIMARY KEY NOT NULL, + "feature_id" integer NOT NULL, + "locale" varchar(10) NOT NULL, + "difficultyNotes" text, + "priceNotes" text, + "allowedAccessNotes" text, + "hasInacurateLocationNotes" text, + "hasMissingInfoNotes" text, + "notThereAnymoreNotes" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "image" ( + "id" serial PRIMARY KEY NOT NULL, + "key" varchar(1024) NOT NULL, + "width" integer NOT NULL, + "height" integer NOT NULL, + "source" text, + "captureDate" timestamp, + "alt" text, + "blurDataURL" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "placeCategory" ( + "id" serial PRIMARY KEY NOT NULL, + "icon" text NOT NULL, + "color" text NOT NULL, + "hasVisitMission" boolean DEFAULT true NOT NULL, + "order" integer, + "name" text NOT NULL, + "namePlural" text NOT NULL, + "nameGender" "gender" +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "placeCategory_translation" ( + "id" serial PRIMARY KEY NOT NULL, + "placeCategory_id" integer NOT NULL, + "locale" varchar(10) NOT NULL, + "name" text NOT NULL, + "namePlural" text NOT NULL, + "nameGender" "gender" +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "placeToPlaceCategory" ( + "placeId" integer NOT NULL, + "categoryId" integer NOT NULL, + CONSTRAINT "placeToPlaceCategory_categoryId_placeId_pk" PRIMARY KEY("categoryId","placeId") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "placeCategoryToPlaceCategoryGroup" ( + "categoryGroupId" integer NOT NULL, + "categoryId" integer NOT NULL, + "highlight" boolean, + CONSTRAINT "placeCategoryToPlaceCategoryGroup_categoryGroupId_categoryId_pk" PRIMARY KEY("categoryGroupId","categoryId") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "placeCategoryGroup" ( + "id" serial PRIMARY KEY NOT NULL, + "icon" text NOT NULL, + "color" text NOT NULL, + "order" integer, + "name" text NOT NULL, + "nameGender" "gender" +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "placeCategoryGroup_translation" ( + "id" serial PRIMARY KEY NOT NULL, + "placeCategoryGroup_id" integer NOT NULL, + "locale" varchar(10) NOT NULL, + "name" text NOT NULL, + "nameGender" "gender" +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "placeListToPlace" ( + "placeListId" integer NOT NULL, + "placeId" integer NOT NULL, + "addedAt" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, + CONSTRAINT "placeListToPlace_placeId_placeListId_pk" PRIMARY KEY("placeId","placeListId") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "placeList" ( + "id" serial PRIMARY KEY NOT NULL, + "userId" varchar(255) NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "place" ( + "id" serial PRIMARY KEY NOT NULL, + "mainImageId" integer, + "googleMapsId" text, + "location" geometry(point,25831) NOT NULL, + "mainCategoryId" integer NOT NULL, + "featuresId" integer NOT NULL, + "verificationRequirementsId" integer, + "importance" double precision, + "name" text NOT NULL, + "description" text, + "content" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "place_translation" ( + "id" serial PRIMARY KEY NOT NULL, + "place_id" integer NOT NULL, + "locale" varchar(10) NOT NULL, + "name" text NOT NULL, + "description" text, + "content" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "routeCategory" ( + "id" serial PRIMARY KEY NOT NULL, + "icon" text NOT NULL, + "color" text NOT NULL, + "hasVisitMission" boolean DEFAULT true NOT NULL, + "order" integer, + "name" text NOT NULL, + "namePlural" text NOT NULL, + "nameGender" "gender" +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "routeCategory_translation" ( + "id" serial PRIMARY KEY NOT NULL, + "routeCategory_id" integer NOT NULL, + "locale" varchar(10) NOT NULL, + "name" text NOT NULL, + "namePlural" text NOT NULL, + "nameGender" "gender" +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "routeToRouteCategory" ( + "routeId" integer NOT NULL, + "categoryId" integer NOT NULL, + CONSTRAINT "routeToRouteCategory_categoryId_routeId_pk" PRIMARY KEY("categoryId","routeId") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "route" ( + "id" serial PRIMARY KEY NOT NULL, + "mainImageId" integer, + "path" Geometry(MultiLineString,25831) NOT NULL, + "mainCategoryId" integer NOT NULL, + "featuresId" integer NOT NULL, + "verificationRequirementsId" integer, + "importance" double precision, + "name" text NOT NULL, + "description" text, + "content" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "routeToPlace" ( + "routeId" integer NOT NULL, + "placeId" integer NOT NULL, + CONSTRAINT "routeToPlace_placeId_routeId_pk" PRIMARY KEY("placeId","routeId") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "route_translation" ( + "id" serial PRIMARY KEY NOT NULL, + "route_id" integer NOT NULL, + "locale" varchar(10) NOT NULL, + "name" text NOT NULL, + "description" text, + "content" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "user" ( + "id" varchar(255) PRIMARY KEY NOT NULL, + "name" text, + "hashedPassword" varchar(255), + "email" text NOT NULL, + "emailVerified" timestamp, + "image" text, + "role" text DEFAULT 'user' NOT NULL, + "visitedPlaceListId" integer NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "verificationRequirement" ( + "id" serial PRIMARY KEY NOT NULL, + "isLocationRequired" boolean DEFAULT true NOT NULL, + "maxLocationDistance" integer +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "verification" ( + "id" serial PRIMARY KEY NOT NULL, + "placeId" integer NOT NULL, + "userId" varchar(255) NOT NULL, + "validatedOn" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, + "deviceLocation" geometry(point,25831), + "deviceLocationAccuracy" integer +); +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "account" ADD CONSTRAINT "account_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "session" ADD CONSTRAINT "session_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/drizzle/meta/0001_snapshot.json b/drizzle/meta/0001_snapshot.json new file mode 100644 index 0000000..ccded54 --- /dev/null +++ b/drizzle/meta/0001_snapshot.json @@ -0,0 +1,1664 @@ +{ + "id": "fa3b99c8-9e78-4785-ad17-8ffe92365961", + "prevId": "df0c4004-b866-4e6e-8fb9-9a87b4b6147b", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "providerAccountId": { + "name": "providerAccountId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "token_type": { + "name": "token_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "session_state": { + "name": "session_state", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "account_userId_user_id_fk": { + "name": "account_userId_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "account_provider_providerAccountId_pk": { + "name": "account_provider_providerAccountId_pk", + "columns": [ + "provider", + "providerAccountId" + ] + } + }, + "uniqueConstraints": {} + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "sessionToken": { + "name": "sessionToken", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_userId_user_id_fk": { + "name": "session_userId_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.verificationToken": { + "name": "verificationToken", + "schema": "", + "columns": { + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "verificationToken_identifier_token_pk": { + "name": "verificationToken_identifier_token_pk", + "columns": [ + "identifier", + "token" + ] + } + }, + "uniqueConstraints": {} + }, + "public.externalLink": { + "name": "externalLink", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "placeId": { + "name": "placeId", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "routeId": { + "name": "routeId", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "isOfficialWebsite": { + "name": "isOfficialWebsite", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.externalLink_translation": { + "name": "externalLink_translation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "externalLink_id": { + "name": "externalLink_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "locale": { + "name": "locale", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.feature": { + "name": "feature", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "amountOfPeople": { + "name": "amountOfPeople", + "type": "amountOfPeople", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "difficulty": { + "name": "difficulty", + "type": "difficulty", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "groundType": { + "name": "groundType", + "type": "groundType", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "hasBus": { + "name": "hasBus", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "hasParking": { + "name": "hasParking", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "parkingSpaces": { + "name": "parkingSpaces", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "hasToilet": { + "name": "hasToilet", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "hasRestaurant": { + "name": "hasRestaurant", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "hasDrinkingWater": { + "name": "hasDrinkingWater", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "hasShower": { + "name": "hasShower", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "hasLifeguard": { + "name": "hasLifeguard", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "hasLeisure": { + "name": "hasLeisure", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "isNudist": { + "name": "isNudist", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "hasUnofficialName": { + "name": "hasUnofficialName", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "hasInacurateLocation": { + "name": "hasInacurateLocation", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "isBoatOnly": { + "name": "isBoatOnly", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "trainingLevel": { + "name": "trainingLevel", + "type": "trainingLevel", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "hasMissingInfo": { + "name": "hasMissingInfo", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "depth": { + "name": "depth", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "depthMin": { + "name": "depthMin", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "depthMax": { + "name": "depthMax", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "scubaDivingLevel": { + "name": "scubaDivingLevel", + "type": "scubaDivingLevel", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "notThereAnymore": { + "name": "notThereAnymore", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "isOutOfTheMunicipality": { + "name": "isOutOfTheMunicipality", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "hasBench": { + "name": "hasBench", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "allowedAccess": { + "name": "allowedAccess", + "type": "allowedAccess", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "dimensions": { + "name": "dimensions", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "price": { + "name": "price", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "priceUnit": { + "name": "priceUnit", + "type": "priceUnit", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "isCovered": { + "name": "isCovered", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "distance": { + "name": "distance", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "slope": { + "name": "slope", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "timeToArrive": { + "name": "timeToArrive", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "placeToArriveFrom": { + "name": "placeToArriveFrom", + "type": "placeToArriveFrom", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "isFreeWithLocalStamp": { + "name": "isFreeWithLocalStamp", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "howNarrow": { + "name": "howNarrow", + "type": "howNarrow", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "difficultyNotes": { + "name": "difficultyNotes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "priceNotes": { + "name": "priceNotes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "allowedAccessNotes": { + "name": "allowedAccessNotes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hasInacurateLocationNotes": { + "name": "hasInacurateLocationNotes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hasMissingInfoNotes": { + "name": "hasMissingInfoNotes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notThereAnymoreNotes": { + "name": "notThereAnymoreNotes", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.feature_translation": { + "name": "feature_translation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "feature_id": { + "name": "feature_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "locale": { + "name": "locale", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "difficultyNotes": { + "name": "difficultyNotes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "priceNotes": { + "name": "priceNotes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "allowedAccessNotes": { + "name": "allowedAccessNotes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hasInacurateLocationNotes": { + "name": "hasInacurateLocationNotes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hasMissingInfoNotes": { + "name": "hasMissingInfoNotes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notThereAnymoreNotes": { + "name": "notThereAnymoreNotes", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.image": { + "name": "image", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "key": { + "name": "key", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": true + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "captureDate": { + "name": "captureDate", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "alt": { + "name": "alt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "blurDataURL": { + "name": "blurDataURL", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.placeCategory": { + "name": "placeCategory", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hasVisitMission": { + "name": "hasVisitMission", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "namePlural": { + "name": "namePlural", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nameGender": { + "name": "nameGender", + "type": "gender", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.placeCategory_translation": { + "name": "placeCategory_translation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "placeCategory_id": { + "name": "placeCategory_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "locale": { + "name": "locale", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "namePlural": { + "name": "namePlural", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nameGender": { + "name": "nameGender", + "type": "gender", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.placeToPlaceCategory": { + "name": "placeToPlaceCategory", + "schema": "", + "columns": { + "placeId": { + "name": "placeId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "categoryId": { + "name": "categoryId", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "placeToPlaceCategory_categoryId_placeId_pk": { + "name": "placeToPlaceCategory_categoryId_placeId_pk", + "columns": [ + "categoryId", + "placeId" + ] + } + }, + "uniqueConstraints": {} + }, + "public.placeCategoryToPlaceCategoryGroup": { + "name": "placeCategoryToPlaceCategoryGroup", + "schema": "", + "columns": { + "categoryGroupId": { + "name": "categoryGroupId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "categoryId": { + "name": "categoryId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "highlight": { + "name": "highlight", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "placeCategoryToPlaceCategoryGroup_categoryGroupId_categoryId_pk": { + "name": "placeCategoryToPlaceCategoryGroup_categoryGroupId_categoryId_pk", + "columns": [ + "categoryGroupId", + "categoryId" + ] + } + }, + "uniqueConstraints": {} + }, + "public.placeCategoryGroup": { + "name": "placeCategoryGroup", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nameGender": { + "name": "nameGender", + "type": "gender", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.placeCategoryGroup_translation": { + "name": "placeCategoryGroup_translation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "placeCategoryGroup_id": { + "name": "placeCategoryGroup_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "locale": { + "name": "locale", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nameGender": { + "name": "nameGender", + "type": "gender", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.placeListToPlace": { + "name": "placeListToPlace", + "schema": "", + "columns": { + "placeListId": { + "name": "placeListId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "placeId": { + "name": "placeId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "addedAt": { + "name": "addedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "placeListToPlace_placeId_placeListId_pk": { + "name": "placeListToPlace_placeId_placeListId_pk", + "columns": [ + "placeId", + "placeListId" + ] + } + }, + "uniqueConstraints": {} + }, + "public.placeList": { + "name": "placeList", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.place": { + "name": "place", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "mainImageId": { + "name": "mainImageId", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "googleMapsId": { + "name": "googleMapsId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "location": { + "name": "location", + "type": "geometry(point)", + "primaryKey": false, + "notNull": true + }, + "mainCategoryId": { + "name": "mainCategoryId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "featuresId": { + "name": "featuresId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "verificationRequirementsId": { + "name": "verificationRequirementsId", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "importance": { + "name": "importance", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.place_translation": { + "name": "place_translation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "place_id": { + "name": "place_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "locale": { + "name": "locale", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.routeCategory": { + "name": "routeCategory", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hasVisitMission": { + "name": "hasVisitMission", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "namePlural": { + "name": "namePlural", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nameGender": { + "name": "nameGender", + "type": "gender", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.routeCategory_translation": { + "name": "routeCategory_translation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "routeCategory_id": { + "name": "routeCategory_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "locale": { + "name": "locale", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "namePlural": { + "name": "namePlural", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nameGender": { + "name": "nameGender", + "type": "gender", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.routeToRouteCategory": { + "name": "routeToRouteCategory", + "schema": "", + "columns": { + "routeId": { + "name": "routeId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "categoryId": { + "name": "categoryId", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "routeToRouteCategory_categoryId_routeId_pk": { + "name": "routeToRouteCategory_categoryId_routeId_pk", + "columns": [ + "categoryId", + "routeId" + ] + } + }, + "uniqueConstraints": {} + }, + "public.route": { + "name": "route", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "mainImageId": { + "name": "mainImageId", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "path": { + "name": "path", + "type": "Geometry(MultiLineString,25831)", + "primaryKey": false, + "notNull": true + }, + "mainCategoryId": { + "name": "mainCategoryId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "featuresId": { + "name": "featuresId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "verificationRequirementsId": { + "name": "verificationRequirementsId", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "importance": { + "name": "importance", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.routeToPlace": { + "name": "routeToPlace", + "schema": "", + "columns": { + "routeId": { + "name": "routeId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "placeId": { + "name": "placeId", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "routeToPlace_placeId_routeId_pk": { + "name": "routeToPlace_placeId_routeId_pk", + "columns": [ + "placeId", + "routeId" + ] + } + }, + "uniqueConstraints": {} + }, + "public.route_translation": { + "name": "route_translation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "route_id": { + "name": "route_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "locale": { + "name": "locale", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hashedPassword": { + "name": "hashedPassword", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "emailVerified": { + "name": "emailVerified", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'user'" + }, + "visitedPlaceListId": { + "name": "visitedPlaceListId", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.verificationRequirement": { + "name": "verificationRequirement", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "isLocationRequired": { + "name": "isLocationRequired", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "maxLocationDistance": { + "name": "maxLocationDistance", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "placeId": { + "name": "placeId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "validatedOn": { + "name": "validatedOn", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "CURRENT_TIMESTAMP" + }, + "deviceLocation": { + "name": "deviceLocation", + "type": "geometry(point)", + "primaryKey": false, + "notNull": false + }, + "deviceLocationAccuracy": { + "name": "deviceLocationAccuracy", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": { + "public.allowedAccess": { + "name": "allowedAccess", + "schema": "public", + "values": [ + "public", + "permissive", + "customers", + "permit", + "private", + "mixed" + ] + }, + "public.amountOfPeople": { + "name": "amountOfPeople", + "schema": "public", + "values": [ + "none", + "few", + "some", + "many", + "crowded" + ] + }, + "public.difficulty": { + "name": "difficulty", + "schema": "public", + "values": [ + "accessible", + "normal", + "smallEffort", + "hard", + "dangerous" + ] + }, + "public.groundType": { + "name": "groundType", + "schema": "public", + "values": [ + "sand", + "pebbles", + "rocks", + "concrete", + "dirt", + "pavimented" + ] + }, + "public.howNarrow": { + "name": "howNarrow", + "schema": "public", + "values": [ + "extremlyNarrow", + "narrow", + "extraSpace", + "wide", + "veryWide" + ] + }, + "public.placeToArriveFrom": { + "name": "placeToArriveFrom", + "schema": "public", + "values": [ + "townCenter", + "parking", + "beach", + "road" + ] + }, + "public.priceUnit": { + "name": "priceUnit", + "schema": "public", + "values": [ + "eur", + "eur/minute", + "eur/hour", + "eur/day" + ] + }, + "public.scubaDivingLevel": { + "name": "scubaDivingLevel", + "schema": "public", + "values": [ + "discoverScubaDiving", + "openWater", + "advancedOpenWater", + "specialtyDiver", + "technicalDiver" + ] + }, + "public.trainingLevel": { + "name": "trainingLevel", + "schema": "public", + "values": [ + "noTraining", + "amateur", + "entryLevel", + "advanced", + "professional", + "elite" + ] + }, + "public.gender": { + "name": "gender", + "schema": "public", + "values": [ + "masculine", + "feminine" + ] + } + }, + "schemas": {}, + "sequences": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index 60c82f0..5db826b 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -8,6 +8,13 @@ "when": 1723146512724, "tag": "0000_nasty_scalphunter", "breakpoints": true + }, + { + "idx": 1, + "version": "7", + "when": 1723213030116, + "tag": "0001_heavy_molten_man", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/server/db/schema/utils.ts b/src/server/db/schema/utils.ts index 909d3d1..367c362 100644 --- a/src/server/db/schema/utils.ts +++ b/src/server/db/schema/utils.ts @@ -3,10 +3,7 @@ import { SRID_CODE } from '~/server/helpers/spatial-data' export const genderEnum = pgEnum('gender', ['masculine', 'feminine']) -export const geometryType = < - TName extends string, - TType extends 'point' | 'linestring' | 'polygon', ->( +export const geometryType = ( name: TName, type: TType ) =>