diff --git a/package.json b/package.json index 6a51496..f069699 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "test:e2e": "jest --config ./test/jest-e2e.json", "generate": "docker exec v3-ad-api sh -c 'npx prisma generate'", "migrate": "docker exec v3-ad-api sh -c 'npx prisma migrate dev'", + "migrate:init": "docker exec v3-ad-api sh -c 'npx prisma migrate dev --name init'", "migrate:test": "dotenv -e .env.test -- npx prisma migrate deploy", "migrate:test:ci": "dotenv -e ci/.env.ci -- npx prisma migrate deploy", "migrate:deploy": "npx prisma migrate deploy" diff --git a/prisma/migrations/20230504100643_init/migration.sql b/prisma/migrations/20230510123439_init/migration.sql similarity index 87% rename from prisma/migrations/20230504100643_init/migration.sql rename to prisma/migrations/20230510123439_init/migration.sql index 8430dc4..efef8e6 100644 --- a/prisma/migrations/20230504100643_init/migration.sql +++ b/prisma/migrations/20230510123439_init/migration.sql @@ -8,11 +8,11 @@ CREATE TYPE "AddressType" AS ENUM ('HOUSE_NUMBER', 'STREET_ADDRESS', 'LOCALITY', CREATE TABLE "ad" ( "uuid" UUID NOT NULL, "userUuid" UUID NOT NULL, - "driver" BOOLEAN, - "passenger" BOOLEAN, - "frequency" "Frequency" NOT NULL DEFAULT 'RECURRENT', + "driver" BOOLEAN NOT NULL, + "passenger" BOOLEAN NOT NULL, + "frequency" "Frequency" NOT NULL, "fromDate" DATE NOT NULL, - "toDate" DATE, + "toDate" DATE NOT NULL, "monTime" TIMESTAMPTZ, "tueTime" TIMESTAMPTZ, "wedTime" TIMESTAMPTZ, @@ -27,8 +27,8 @@ CREATE TABLE "ad" ( "friMargin" INTEGER, "satMargin" INTEGER, "sunMargin" INTEGER, - "seatsDriver" SMALLINT, - "seatsPassenger" SMALLINT, + "seatsDriver" SMALLINT NOT NULL, + "seatsPassenger" SMALLINT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -42,12 +42,13 @@ CREATE TABLE "address" ( "position" SMALLINT NOT NULL, "lon" DOUBLE PRECISION NOT NULL, "lat" DOUBLE PRECISION NOT NULL, + "name" TEXT, "houseNumber" TEXT, "street" TEXT, "locality" TEXT, "postalCode" TEXT, "country" TEXT, - "type" "AddressType" DEFAULT 'OTHER', + "type" "AddressType", "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 429a9ef..5cbb3e6 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -15,7 +15,7 @@ model Ad { userUuid String @db.Uuid driver Boolean passenger Boolean - frequency Frequency @default(RECURRENT) + frequency Frequency fromDate DateTime @db.Date toDate DateTime @db.Date monTime DateTime? @db.Timestamptz() @@ -51,12 +51,13 @@ model Address { position Int @db.SmallInt lon Float lat Float + name String? houseNumber String? street String? locality String? postalCode String? country String? - type AddressType? @default(OTHER) + type AddressType? createdAt DateTime @default(now()) updatedAt DateTime @default(now()) @updatedAt Ad Ad @relation(fields: [adUuid], references: [uuid], onDelete: Cascade) @@ -70,7 +71,6 @@ enum Frequency { } enum AddressType { - NAME HOUSE_NUMBER STREET_ADDRESS LOCALITY