-- CreateTable
CREATE TABLE "ad" (
    "uuid" UUID NOT NULL,
    "userUuid" UUID NOT NULL,
    "driver" BOOLEAN NOT NULL,
    "passenger" BOOLEAN NOT NULL,
    "frequency" INTEGER NOT NULL,
    "fromDate" DATE NOT NULL,
    "toDate" DATE NOT NULL,
    "monTime" TIMESTAMPTZ NOT NULL,
    "tueTime" TIMESTAMPTZ NOT NULL,
    "wedTime" TIMESTAMPTZ NOT NULL,
    "thuTime" TIMESTAMPTZ NOT NULL,
    "friTime" TIMESTAMPTZ NOT NULL,
    "satTime" TIMESTAMPTZ NOT NULL,
    "sunTime" TIMESTAMPTZ NOT NULL,
    "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,
    "seatsDriver" SMALLINT NOT NULL,
    "seatsPassenger" SMALLINT 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,
    "lon" DOUBLE PRECISION NOT NULL,
    "lat" DOUBLE PRECISION NOT NULL,
    "houseNumber" TEXT NOT NULL,
    "street" TEXT NOT NULL,
    "locality" TEXT NOT NULL,
    "postalCode" TEXT NOT NULL,
    "country" TEXT NOT NULL,
    "type" SMALLINT NOT NULL,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

    CONSTRAINT "address_pkey" PRIMARY KEY ("uuid")
);

-- CreateIndex
CREATE INDEX "ad_driver_idx" ON "ad"("driver");

-- CreateIndex
CREATE INDEX "ad_passenger_idx" ON "ad"("passenger");

-- CreateIndex
CREATE INDEX "ad_fromDate_idx" ON "ad"("fromDate");

-- CreateIndex
CREATE INDEX "ad_toDate_idx" ON "ad"("toDate");
