-- AlterTable
ALTER TABLE "binom_v2_account" ADD CONSTRAINT "binom_v2_account_pkey" PRIMARY KEY ("id");

-- AlterTable
ALTER TABLE "binom_v2_campaign" ADD CONSTRAINT "binom_v2_campaign_pkey" PRIMARY KEY ("id");

-- AlterTable
ALTER TABLE "binom_v2_campaign_date_stat" ADD CONSTRAINT "binom_v2_campaign_date_stat_pkey" PRIMARY KEY ("id");

-- AlterTable
ALTER TABLE "binom_v2_group" ADD CONSTRAINT "binom_v2_group_pkey" PRIMARY KEY ("id");

-- AlterTable
ALTER TABLE "binom_v2_traffic_source" ADD CONSTRAINT "binom_v2_traffic_source_pkey" PRIMARY KEY ("id");

-- AlterTable
ALTER TABLE "binom_v2_traffic_source_token" ADD CONSTRAINT "binom_v2_traffic_source_token_pkey" PRIMARY KEY ("id");

-- AlterTable
ALTER TABLE "inuvo_campaign" ADD COLUMN     "adText" TEXT NOT NULL DEFAULT '';

-- CreateTable
CREATE TABLE "binom_v2_offer" (
    "id" SERIAL NOT NULL,
    "externalId" TEXT NOT NULL,
    "name" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "_BinomV2CampaignToBinomV2Offer" (
    "A" INTEGER NOT NULL,
    "B" INTEGER NOT NULL,

    CONSTRAINT "_BinomV2CampaignToBinomV2Offer_AB_pkey" PRIMARY KEY ("A","B")
);

-- CreateIndex
CREATE UNIQUE INDEX "binom_v2_offer_id_key" ON "binom_v2_offer"("id");

-- CreateIndex
CREATE INDEX "_BinomV2CampaignToBinomV2Offer_B_index" ON "_BinomV2CampaignToBinomV2Offer"("B");

-- RenameForeignKey
ALTER TABLE "binom_v2_group" RENAME CONSTRAINT "binom_v2_campaign_group_binomV2AccountId_fkey" TO "binom_v2_group_binomV2AccountId_fkey";

-- AddForeignKey
ALTER TABLE "_BinomV2CampaignToBinomV2Offer" ADD CONSTRAINT "_BinomV2CampaignToBinomV2Offer_A_fkey" FOREIGN KEY ("A") REFERENCES "binom_v2_campaign"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "_BinomV2CampaignToBinomV2Offer" ADD CONSTRAINT "_BinomV2CampaignToBinomV2Offer_B_fkey" FOREIGN KEY ("B") REFERENCES "binom_v2_offer"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- RenameIndex
ALTER INDEX "binom_v2_campaign_group_id_key" RENAME TO "binom_v2_group_id_key";
