-- CreateTable
CREATE TABLE "telegram_bot" (
    "id" SERIAL NOT NULL,
    "name" TEXT NOT NULL,
    "botKey" TEXT NOT NULL,

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

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

-- CreateIndex
CREATE UNIQUE INDEX "_TelegramBotToUser_AB_unique" ON "_TelegramBotToUser"("A", "B");

-- CreateIndex
CREATE INDEX "_TelegramBotToUser_B_index" ON "_TelegramBotToUser"("B");

-- AddForeignKey
ALTER TABLE "_TelegramBotToUser" ADD CONSTRAINT "_TelegramBotToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "telegram_bot"("id") ON DELETE CASCADE ON UPDATE CASCADE;

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