ad/prisma/migrations/20230515131219_init/migration.sql

57 lines
1.6 KiB
MySQL
Raw Normal View History

-- CreateEnum
CREATE TYPE "Frequency" AS ENUM ('PUNCTUAL', 'RECURRENT');
-- CreateTable
CREATE TABLE "ad" (
"uuid" UUID NOT NULL,
"userUuid" UUID NOT NULL,
2023-05-10 12:37:00 +00:00
"driver" BOOLEAN NOT NULL,
"passenger" BOOLEAN NOT NULL,
"frequency" "Frequency" NOT NULL,
"fromDate" DATE NOT NULL,
2023-05-10 12:37:00 +00:00
"toDate" DATE NOT NULL,
2023-05-15 15:00:05 +00:00
"monTime" TEXT,
"tueTime" TEXT,
"wedTime" TEXT,
"thuTime" TEXT,
"friTime" TEXT,
"satTime" TEXT,
"sunTime" TEXT,
2023-05-11 09:17:47 +00:00
"monMargin" INTEGER NOT NULL,
"tueMargin" INTEGER NOT NULL,
"wedMargin" INTEGER NOT NULL,
"thuMargin" INTEGER NOT NULL,
"friMargin" INTEGER NOT NULL,
"satMargin" INTEGER NOT NULL,
"sunMargin" INTEGER NOT NULL,
2023-05-10 12:37:00 +00:00
"seatsDriver" SMALLINT NOT NULL,
"seatsPassenger" SMALLINT NOT NULL,
2023-05-11 09:17:47 +00:00
"strict" BOOLEAN NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "ad_pkey" PRIMARY KEY ("uuid")
);
-- CreateTable
CREATE TABLE "address" (
"uuid" UUID NOT NULL,
"adUuid" UUID NOT NULL,
"position" SMALLINT NOT NULL,
"lon" DOUBLE PRECISION NOT NULL,
"lat" DOUBLE PRECISION NOT NULL,
2023-05-10 12:37:00 +00:00
"name" TEXT,
"houseNumber" TEXT,
"street" TEXT,
"locality" TEXT,
"postalCode" TEXT,
2023-05-15 15:00:05 +00:00
"country" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "address_pkey" PRIMARY KEY ("uuid")
);
2023-05-04 08:05:23 +00:00
-- AddForeignKey
ALTER TABLE "address" ADD CONSTRAINT "address_adUuid_fkey" FOREIGN KEY ("adUuid") REFERENCES "ad"("uuid") ON DELETE CASCADE ON UPDATE CASCADE;