/*
  Warnings:

  - You are about to drop the `cg_tbl_helpers` table. If the table is not empty, all the data it contains will be lost.

*/
-- DropTable
DROP TABLE `cg_tbl_helpers`;

-- CreateTable
CREATE TABLE `cg_tbl_helper_interns` (
    `id` BIGINT NOT NULL AUTO_INCREMENT,
    `role_id` BIGINT NULL,
    `first_name` VARCHAR(100) NULL,
    `last_name` VARCHAR(100) NULL,
    `mobile` VARCHAR(20) NULL,
    `email` VARCHAR(150) NULL,
    `language_ids` JSON NULL,
    `blood_group` VARCHAR(20) NULL,
    `aadhaar_number` VARCHAR(20) NULL,
    `pan_number` VARCHAR(20) NULL,
    `cin_number` VARCHAR(50) NULL,
    `dob` DATE NULL,
    `address` TEXT NULL,
    `state` VARCHAR(100) NULL,
    `city` VARCHAR(100) NULL,
    `zone` JSON NULL,
    `pincode` VARCHAR(10) NULL,
    `country_code` VARCHAR(10) NULL,
    `bank_name` VARCHAR(150) NULL,
    `bank_account_number` VARCHAR(50) NULL,
    `bank_ifsc_code` VARCHAR(20) NULL,
    `skills` JSON NULL,
    `emergency_contact_name` VARCHAR(100) NULL,
    `emergency_contact_number` VARCHAR(20) NULL,
    `relationship` VARCHAR(50) NULL,
    `pan_card_file` VARCHAR(255) NULL,
    `gst_file` VARCHAR(255) NULL,
    `cin_file` VARCHAR(255) NULL,
    `bank_document_file` VARCHAR(255) NULL,
    `aadhaar_card_file` VARCHAR(255) NULL,
    `profile_photo_file` VARCHAR(255) NULL,
    `education_certificate_file` VARCHAR(255) NULL,
    `police_verification_file` VARCHAR(255) NULL,
    `status` INTEGER NULL,
    `is_verified` INTEGER NULL,
    `created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
    `updated_at` TIMESTAMP(0) NULL,

    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `cg_tbl_phone_verifications` (
    `id` BIGINT NOT NULL AUTO_INCREMENT,
    `mobile` VARCHAR(20) NOT NULL,
    `otp_code` VARCHAR(10) NOT NULL,
    `expires_at` TIMESTAMP(0) NOT NULL,
    `created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
    `updated_at` TIMESTAMP(0) NULL,

    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `cg_tbl_refresh_tokens` (
    `id` BIGINT NOT NULL AUTO_INCREMENT,
    `user_id` BIGINT NOT NULL,
    `role_id` BIGINT NULL,
    `token` VARCHAR(500) NOT NULL,
    `expires_at` TIMESTAMP(0) NOT NULL,
    `created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
    `updated_at` TIMESTAMP(0) NULL,

    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `cg_tbl_helper_interns` ADD CONSTRAINT `cg_tbl_helper_interns_role_id_fkey` FOREIGN KEY (`role_id`) REFERENCES `cg_tbl_user_roles`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

-- AddForeignKey
ALTER TABLE `cg_tbl_refresh_tokens` ADD CONSTRAINT `cg_tbl_refresh_tokens_role_id_fkey` FOREIGN KEY (`role_id`) REFERENCES `cg_tbl_user_roles`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
