update prisma migration

This commit is contained in:
Grégoire Chevalier 2023-05-10 14:37:00 +02:00
parent fe315bbbd7
commit 5095082f2e
3 changed files with 12 additions and 10 deletions

View File

@ -26,6 +26,7 @@
"test:e2e": "jest --config ./test/jest-e2e.json", "test:e2e": "jest --config ./test/jest-e2e.json",
"generate": "docker exec v3-ad-api sh -c 'npx prisma generate'", "generate": "docker exec v3-ad-api sh -c 'npx prisma generate'",
"migrate": "docker exec v3-ad-api sh -c 'npx prisma migrate dev'", "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": "dotenv -e .env.test -- npx prisma migrate deploy",
"migrate:test:ci": "dotenv -e ci/.env.ci -- npx prisma migrate deploy", "migrate:test:ci": "dotenv -e ci/.env.ci -- npx prisma migrate deploy",
"migrate:deploy": "npx prisma migrate deploy" "migrate:deploy": "npx prisma migrate deploy"

View File

@ -8,11 +8,11 @@ CREATE TYPE "AddressType" AS ENUM ('HOUSE_NUMBER', 'STREET_ADDRESS', 'LOCALITY',
CREATE TABLE "ad" ( CREATE TABLE "ad" (
"uuid" UUID NOT NULL, "uuid" UUID NOT NULL,
"userUuid" UUID NOT NULL, "userUuid" UUID NOT NULL,
"driver" BOOLEAN, "driver" BOOLEAN NOT NULL,
"passenger" BOOLEAN, "passenger" BOOLEAN NOT NULL,
"frequency" "Frequency" NOT NULL DEFAULT 'RECURRENT', "frequency" "Frequency" NOT NULL,
"fromDate" DATE NOT NULL, "fromDate" DATE NOT NULL,
"toDate" DATE, "toDate" DATE NOT NULL,
"monTime" TIMESTAMPTZ, "monTime" TIMESTAMPTZ,
"tueTime" TIMESTAMPTZ, "tueTime" TIMESTAMPTZ,
"wedTime" TIMESTAMPTZ, "wedTime" TIMESTAMPTZ,
@ -27,8 +27,8 @@ CREATE TABLE "ad" (
"friMargin" INTEGER, "friMargin" INTEGER,
"satMargin" INTEGER, "satMargin" INTEGER,
"sunMargin" INTEGER, "sunMargin" INTEGER,
"seatsDriver" SMALLINT, "seatsDriver" SMALLINT NOT NULL,
"seatsPassenger" SMALLINT, "seatsPassenger" SMALLINT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" 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, "position" SMALLINT NOT NULL,
"lon" DOUBLE PRECISION NOT NULL, "lon" DOUBLE PRECISION NOT NULL,
"lat" DOUBLE PRECISION NOT NULL, "lat" DOUBLE PRECISION NOT NULL,
"name" TEXT,
"houseNumber" TEXT, "houseNumber" TEXT,
"street" TEXT, "street" TEXT,
"locality" TEXT, "locality" TEXT,
"postalCode" TEXT, "postalCode" TEXT,
"country" TEXT, "country" TEXT,
"type" "AddressType" DEFAULT 'OTHER', "type" "AddressType",
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

View File

@ -15,7 +15,7 @@ model Ad {
userUuid String @db.Uuid userUuid String @db.Uuid
driver Boolean driver Boolean
passenger Boolean passenger Boolean
frequency Frequency @default(RECURRENT) frequency Frequency
fromDate DateTime @db.Date fromDate DateTime @db.Date
toDate DateTime @db.Date toDate DateTime @db.Date
monTime DateTime? @db.Timestamptz() monTime DateTime? @db.Timestamptz()
@ -51,12 +51,13 @@ model Address {
position Int @db.SmallInt position Int @db.SmallInt
lon Float lon Float
lat Float lat Float
name String?
houseNumber String? houseNumber String?
street String? street String?
locality String? locality String?
postalCode String? postalCode String?
country String? country String?
type AddressType? @default(OTHER) type AddressType?
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt updatedAt DateTime @default(now()) @updatedAt
Ad Ad @relation(fields: [adUuid], references: [uuid], onDelete: Cascade) Ad Ad @relation(fields: [adUuid], references: [uuid], onDelete: Cascade)
@ -70,7 +71,6 @@ enum Frequency {
} }
enum AddressType { enum AddressType {
NAME
HOUSE_NUMBER HOUSE_NUMBER
STREET_ADDRESS STREET_ADDRESS
LOCALITY LOCALITY