/*
  Warnings:

  - You are about to drop the column `alternatePhoneNumber` on the `Users` table. All the data in the column will be lost.
  - You are about to drop the column `mail_sent_date` on the `Users` table. All the data in the column will be lost.
  - You are about to drop the column `mail_status` on the `Users` table. All the data in the column will be lost.
  - You are about to drop the column `verification_status` on the `Users` table. All the data in the column will be lost.
  - You are about to alter the column `sex` on the `Users` table. The data in that column could be lost. The data in that column will be cast from `Enum(EnumId(0))` to `VarChar(191)`.
  - You are about to drop the `Admins` table. If the table is not empty, all the data it contains will be lost.
  - Added the required column `user_role_id` to the `Users` table without a default value. This is not possible if the table is not empty.

*/
-- AlterTable
ALTER TABLE `Users` DROP COLUMN `alternatePhoneNumber`,
    DROP COLUMN `mail_sent_date`,
    DROP COLUMN `mail_status`,
    DROP COLUMN `verification_status`,
    ADD COLUMN `isAccreditedByAdmin` BOOLEAN NOT NULL DEFAULT false,
    ADD COLUMN `isVerified` BOOLEAN NOT NULL DEFAULT false,
    ADD COLUMN `streetAddress` VARCHAR(191) NULL,
    ADD COLUMN `user_role_id` VARCHAR(191) NOT NULL,
    MODIFY `sex` VARCHAR(191) NOT NULL,
    MODIFY `password` VARCHAR(191) NULL;

-- DropTable
DROP TABLE `Admins`;

-- CreateTable
CREATE TABLE `User_Roles` (
    `role_id` VARCHAR(191) NOT NULL,
    `role_name` VARCHAR(191) NOT NULL,
    `role_description` VARCHAR(191) NULL,
    `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updatedAt` DATETIME(3) NULL,

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

-- AddForeignKey
ALTER TABLE `Users` ADD CONSTRAINT `Users_user_role_id_fkey` FOREIGN KEY (`user_role_id`) REFERENCES `User_Roles`(`role_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
