/*
  Warnings:

  - The values [WAITING_CHANNEL_ID,WAITING_CHANNEL_TITLE,WAITING_PLAN_DURATION] on the enum `TelegramSessionStep` will be removed. If these variants are still used in the database, this will fail.
  - Added the required column `durationUnit` to the `Plan` table without a default value. This is not possible if the table is not empty.
  - Added the required column `durationValue` to the `Plan` table without a default value. This is not possible if the table is not empty.

*/
-- CreateEnum
CREATE TYPE "DurationUnit" AS ENUM ('DAY', 'MONTH', 'YEAR');

-- AlterEnum
BEGIN;
CREATE TYPE "TelegramSessionStep_new" AS ENUM ('IDLE', 'WAITING_CHANNEL_ADMIN_CONFIRM', 'WAITING_PLAN_TITLE', 'WAITING_PLAN_DURATION_UNIT', 'WAITING_PLAN_DURATION_VALUE', 'WAITING_PLAN_PRICE');
ALTER TABLE "public"."TelegramSession" ALTER COLUMN "step" DROP DEFAULT;
ALTER TABLE "TelegramSession" ALTER COLUMN "step" TYPE "TelegramSessionStep_new" USING ("step"::text::"TelegramSessionStep_new");
ALTER TYPE "TelegramSessionStep" RENAME TO "TelegramSessionStep_old";
ALTER TYPE "TelegramSessionStep_new" RENAME TO "TelegramSessionStep";
DROP TYPE "public"."TelegramSessionStep_old";
ALTER TABLE "TelegramSession" ALTER COLUMN "step" SET DEFAULT 'IDLE';
COMMIT;

-- AlterTable
ALTER TABLE "Plan" ADD COLUMN     "durationUnit" "DurationUnit" NOT NULL,
ADD COLUMN     "durationValue" INTEGER NOT NULL;
