/*
  Warnings:

  - You are about to drop the column `gstNumber` on the `institution` table. All the data in the column will be lost.
  - You are about to drop the column `amount` on the `transaction` table. All the data in the column will be lost.

*/
-- AlterTable
ALTER TABLE `institution` DROP COLUMN `gstNumber`;

-- AlterTable
ALTER TABLE `subscriptionplan` ADD COLUMN `isVisible` BOOLEAN NOT NULL DEFAULT true;

-- AlterTable
ALTER TABLE `transaction` 
    CHANGE COLUMN `amount` `totalAmount` DECIMAL(10, 2) NOT NULL DEFAULT 0,
    ADD COLUMN `cgstAmount` DECIMAL(10, 2) NOT NULL DEFAULT 0,
    ADD COLUMN `customerGstNumber` VARCHAR(191) NULL,
    ADD COLUMN `gstAmount` DECIMAL(10, 2) NOT NULL DEFAULT 0,
    ADD COLUMN `gstRate` DECIMAL(5, 2) NOT NULL DEFAULT 0,
    ADD COLUMN `gstType` ENUM('CGST_SGST', 'IGST', 'EXEMPT', 'ZERO_RATED') NULL,
    ADD COLUMN `igstAmount` DECIMAL(10, 2) NOT NULL DEFAULT 0,
    ADD COLUMN `sgstAmount` DECIMAL(10, 2) NOT NULL DEFAULT 0,
    ADD COLUMN `taxableAmount` DECIMAL(10, 2) NOT NULL DEFAULT 0;

-- AlterTable
ALTER TABLE `user` ADD COLUMN `gstNumber` VARCHAR(191) NULL,
    ADD COLUMN `pincode` CHAR(6) NULL,
    ADD COLUMN `state` VARCHAR(191) NULL;

-- CreateTable
CREATE TABLE `sequences` (
    `id` VARCHAR(191) NOT NULL,
    `type` VARCHAR(191) NOT NULL,
    `prefix` VARCHAR(191) NOT NULL,
    `lastCount` INTEGER NOT NULL DEFAULT 0,
    `isActive` BOOLEAN NOT NULL DEFAULT true,
    `endedAt` DATETIME(3) NULL,
    `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updatedAt` DATETIME(3) NOT NULL,

    INDEX `sequences_type_isActive_idx`(`type`, `isActive`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
