/*
  Warnings:

  - You are about to drop the column `userId` on the `TelegramSession` table. All the data in the column will be lost.
  - A unique constraint covering the columns `[telegramId]` on the table `TelegramSession` will be added. If there are existing duplicate values, this will fail.
  - Added the required column `telegramId` 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_userId_fkey";

-- DropIndex
DROP INDEX "TelegramSession_userId_key";

-- AlterTable
ALTER TABLE "TelegramSession" DROP COLUMN "userId",
ADD COLUMN     "telegramId" TEXT NOT NULL;

-- CreateIndex
CREATE UNIQUE INDEX "TelegramSession_telegramId_key" ON "TelegramSession"("telegramId");

-- AddForeignKey
ALTER TABLE "TelegramSession" ADD CONSTRAINT "TelegramSession_telegramId_fkey" FOREIGN KEY ("telegramId") REFERENCES "User"("telegramId") ON DELETE RESTRICT ON UPDATE CASCADE;
