-- CreateTable
CREATE TABLE "BinomDomain" (
    "id" SERIAL NOT NULL,
    "createDate" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "name" TEXT NOT NULL,
    "sslValidTime" TIMESTAMP(3) NOT NULL,
    "binomDomainId" TEXT NOT NULL,
    "campaigns" INTEGER NOT NULL,
    "status" TEXT NOT NULL,
    "ssl" TEXT NOT NULL,
    "sslStatus" TEXT NOT NULL,

    CONSTRAINT "BinomDomain_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "_BinomDomainToUser" (
    "A" INTEGER NOT NULL,
    "B" INTEGER NOT NULL
);

-- CreateIndex
CREATE UNIQUE INDEX "_BinomDomainToUser_AB_unique" ON "_BinomDomainToUser"("A", "B");

-- CreateIndex
CREATE INDEX "_BinomDomainToUser_B_index" ON "_BinomDomainToUser"("B");

-- AddForeignKey
ALTER TABLE "_BinomDomainToUser" ADD CONSTRAINT "_BinomDomainToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "BinomDomain"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "_BinomDomainToUser" ADD CONSTRAINT "_BinomDomainToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
