/*
  Warnings:

  - Added the required column `binomCampaignId` to the `tonic_campaign` table without a default value. This is not possible if the table is not empty.
  - Added the required column `tonicAccountId` to the `tonic_campaign` table without a default value. This is not possible if the table is not empty.

*/
-- DropForeignKey
ALTER TABLE "tonic_campaign" DROP CONSTRAINT "tonic_campaign_pixelId_fkey";

-- DropIndex
DROP INDEX "tonic_campaign_pixelId_key";

-- AlterTable
ALTER TABLE "tonic_campaign" ADD COLUMN     "binomCampaignId" INTEGER NOT NULL,
ADD COLUMN     "binomOfferId" TEXT,
ADD COLUMN     "pixelToken" TEXT,
ADD COLUMN     "tonicAccountId" INTEGER NOT NULL,
ALTER COLUMN "pixelId" SET DATA TYPE TEXT;

-- CreateTable
CREATE TABLE "BinomCampaign" (
    "id" SERIAL NOT NULL,
    "createAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updateAt" TIMESTAMP(3) NOT NULL,
    "binomCampaignName" TEXT NOT NULL,
    "binomCampaignId" TEXT,

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

-- AddForeignKey
ALTER TABLE "tonic_campaign" ADD CONSTRAINT "tonic_campaign_tonicAccountId_fkey" FOREIGN KEY ("tonicAccountId") REFERENCES "tonic_account"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "tonic_campaign" ADD CONSTRAINT "tonic_campaign_binomCampaignId_fkey" FOREIGN KEY ("binomCampaignId") REFERENCES "BinomCampaign"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
