/*
  Warnings:

  - You are about to drop the column `telegramId` on the `TelegramSession` table. All the data in the column will be lost.
  - A unique constraint covering the columns `[userId]` on the table `TelegramSession` will be added. If there are existing duplicate values, this will fail.
  - Added the required column `userId` to the `TelegramSession` table without a default value. This is not possible if the table is not empty.

*/
-- DropForeignKey
ALTER TABLE "TelegramSession" DROP CONSTRAINT "TelegramSession_telegramId_fkey";

-- DropIndex
DROP INDEX "TelegramSession_telegramId_key";

-- AlterTable
ALTER TABLE "TelegramSession" DROP COLUMN "telegramId",
ADD COLUMN     "userId" TEXT NOT NULL;

-- CreateIndex
CREATE UNIQUE INDEX "TelegramSession_userId_key" ON "TelegramSession"("userId");

-- AddForeignKey
ALTER TABLE "TelegramSession" ADD CONSTRAINT "TelegramSession_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
