-- CreateTable
CREATE TABLE "ExternalBot" (
    "id" TEXT NOT NULL PRIMARY KEY,
    "name" TEXT NOT NULL,
    "token" TEXT NOT NULL,
    "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);

-- CreateTable
CREATE TABLE "_BotsInInterface" (
    "A" TEXT NOT NULL,
    "B" TEXT NOT NULL,
    CONSTRAINT "_BotsInInterface_A_fkey" FOREIGN KEY ("A") REFERENCES "Bot" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT "_BotsInInterface_B_fkey" FOREIGN KEY ("B") REFERENCES "ExternalBot" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);

-- CreateIndex
CREATE UNIQUE INDEX "ExternalBot_token_key" ON "ExternalBot"("token");

-- CreateIndex
CREATE UNIQUE INDEX "_BotsInInterface_AB_unique" ON "_BotsInInterface"("A", "B");

-- CreateIndex
CREATE INDEX "_BotsInInterface_B_index" ON "_BotsInInterface"("B");
