"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NewDatabaseConnection1780738512641 = void 0;
class NewDatabaseConnection1780738512641 {
    constructor() {
        this.name = 'NewDatabaseConnection1780738512641';
    }
    async up(queryRunner) {
        if (await queryRunner.hasTable('access_roles')) {
            try {
                await queryRunner.query(`ALTER TABLE \`access_roles\` DROP FOREIGN KEY \`FK_access_roles_owner\``);
            }
            catch (e) { }
        }
        if (await queryRunner.hasTable('role_permissions')) {
            try {
                await queryRunner.query(`ALTER TABLE \`role_permissions\` DROP FOREIGN KEY \`FK_role_permissions_role\``);
            }
            catch (e) { }
        }
        if (await queryRunner.hasTable('access_roles')) {
            try {
                await queryRunner.query(`DROP INDEX \`IDX_access_roles_owner_slug\` ON \`access_roles\``);
            }
            catch (e) { }
        }
        if (await queryRunner.hasTable('role_permissions')) {
            try {
                await queryRunner.query(`DROP INDEX \`IDX_role_permissions_role_key\` ON \`role_permissions\``);
            }
            catch (e) { }
        }
        await queryRunner.query(`ALTER TABLE \`members\` ADD \`access_role_id\` varchar(36) NULL`);
        await queryRunner.query(`ALTER TABLE \`owner\` CHANGE \`otp\` \`otp\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`owner\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`owner\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`company\` CHANGE \`founded_at\` \`founded_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP`);
        await queryRunner.query(`ALTER TABLE \`company\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`company\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`working_schedule\` CHANGE \`office_start_time\` \`office_start_time\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP`);
        await queryRunner.query(`ALTER TABLE \`working_schedule\` CHANGE \`office_end_time\` \`office_end_time\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP`);
        await queryRunner.query(`ALTER TABLE \`working_schedule\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`working_schedule\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`leave_policy\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`leave_policy\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`departments\` DROP FOREIGN KEY \`FK_200f04e4849cb794d547b6983a1\``);
        await queryRunner.query(`ALTER TABLE \`departments\` CHANGE \`department_head_id\` \`department_head_id\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`departments\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`departments\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`designations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`designations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`locations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`locations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`employement_types\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`employement_types\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`hiring_sources\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`hiring_sources\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`events\` CHANGE \`date\` \`date\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP`);
        await queryRunner.query(`ALTER TABLE \`events\` CHANGE \`start_time\` \`start_time\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP`);
        await queryRunner.query(`ALTER TABLE \`events\` CHANGE \`end_time\` \`end_time\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP`);
        await queryRunner.query(`ALTER TABLE \`events\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`events\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`notices\` CHANGE \`published_at\` \`published_at\` datetime NULL`);
        await queryRunner.query(`ALTER TABLE \`notices\` CHANGE \`expire_at\` \`expire_at\` datetime NULL`);
        await queryRunner.query(`ALTER TABLE \`notices\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`notices\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_3eee8d9bac20dbabce411c52f4f\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_62933351fdb38047703e3b8d1e5\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_a9e0bf4c88d3885191d5385022b\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_a595b5a2db232be2233684ca05b\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_aae2956f6114f0dd9fbe76e567c\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_6259d4592d7c24fca9fb21f7938\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_438c781d1af76adc5cc6d9d1d1c\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_88cffc021429fd8f833f1c3f15a\``);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`date_of_birth\` \`date_of_birth\` datetime NULL`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`date_of_joining\` \`date_of_joining\` datetime NULL DEFAULT CURRENT_TIMESTAMP`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`department_id\` \`department_id\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`designation_id\` \`designation_id\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`location_id\` \`location_id\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`employment_type_id\` \`employment_type_id\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`hiring_source_id\` \`hiring_source_id\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`reporting_manager_id\` \`reporting_manager_id\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`eventsId\` \`eventsId\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`noticesId\` \`noticesId\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`work_experiences\` CHANGE \`end_date\` \`end_date\` datetime NULL`);
        await queryRunner.query(`ALTER TABLE \`work_experiences\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`work_experiences\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`educations\` CHANGE \`end_date\` \`end_date\` datetime NULL`);
        await queryRunner.query(`ALTER TABLE \`educations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`educations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`attendance_breaks\` CHANGE \`break_end\` \`break_end\` datetime NULL`);
        await queryRunner.query(`ALTER TABLE \`attendance_breaks\` CHANGE \`break_reminder_sent_at\` \`break_reminder_sent_at\` timestamp NULL`);
        await queryRunner.query(`ALTER TABLE \`attendance_breaks\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`attendance_breaks\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`attendances\` DROP FOREIGN KEY \`FK_4fa5236dedf60886a5d2099e926\``);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`check_in\` \`check_in\` datetime NULL`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`check_out\` \`check_out\` datetime NULL`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`lunch_start\` \`lunch_start\` datetime NULL`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`lunch_end\` \`lunch_end\` datetime NULL`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`location_id\` \`location_id\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`checkout_reminder_sent_at\` \`checkout_reminder_sent_at\` timestamp NULL`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`leaves\` DROP FOREIGN KEY \`FK_6c9e43bf1012677777c1d8de6af\``);
        await queryRunner.query(`ALTER TABLE \`leaves\` DROP FOREIGN KEY \`FK_c37c05ad776088b265793ecb9c9\``);
        await queryRunner.query(`ALTER TABLE \`leaves\` CHANGE \`approver_type\` \`approver_type\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`leaves\` CHANGE \`approver_owner_id\` \`approver_owner_id\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`leaves\` CHANGE \`approver_member_id\` \`approver_member_id\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`leaves\` CHANGE \`approved_at\` \`approved_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP`);
        await queryRunner.query(`ALTER TABLE \`leaves\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`leaves\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`holidays\` CHANGE \`start_date\` \`start_date\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP`);
        await queryRunner.query(`ALTER TABLE \`holidays\` CHANGE \`end_date\` \`end_date\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP`);
        await queryRunner.query(`ALTER TABLE \`holidays\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`holidays\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`notifications\` CHANGE \`source_id\` \`source_id\` varchar(191) NULL`);
        await queryRunner.query(`ALTER TABLE \`notifications\` DROP COLUMN \`meta\``);
        await queryRunner.query(`ALTER TABLE \`notifications\` ADD \`meta\` json NULL`);
        await queryRunner.query(`ALTER TABLE \`notification_targets\` DROP COLUMN \`target_value\``);
        await queryRunner.query(`ALTER TABLE \`notification_targets\` ADD \`target_value\` json NULL`);
        await queryRunner.query(`ALTER TABLE \`notification_receivers\` CHANGE \`read_at\` \`read_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP`);
        if (await queryRunner.hasTable('access_roles')) {
            try {
                await queryRunner.query(`ALTER TABLE \`access_roles\` CHANGE \`created_at\` \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)`);
            }
            catch (e) { }
        }
        if (await queryRunner.hasTable('access_roles')) {
            try {
                await queryRunner.query(`ALTER TABLE \`access_roles\` CHANGE \`updated_at\` \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(3)`);
            }
            catch (e) { }
        }
        if (await queryRunner.hasTable('role_permissions')) {
            try {
                await queryRunner.query(`ALTER TABLE \`role_permissions\` CHANGE \`created_at\` \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)`);
            }
            catch (e) { }
        }
        if (await queryRunner.hasTable('role_permissions')) {
            try {
                await queryRunner.query(`ALTER TABLE \`role_permissions\` CHANGE \`updated_at\` \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(3)`);
            }
            catch (e) { }
        }
        if (await queryRunner.hasTable('access_roles')) {
            try {
                await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_9c18d618c2563fd5fa913c22d4\` ON \`access_roles\` (\`owner_id\`, \`slug\`)`);
            }
            catch (e) { }
        }
        if (await queryRunner.hasTable('role_permissions')) {
            try {
                await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_064de54701f3ac10466efa130a\` ON \`role_permissions\` (\`role_id\`, \`permission_key\`)`);
            }
            catch (e) { }
        }
        await queryRunner.query(`ALTER TABLE \`departments\` ADD CONSTRAINT \`FK_200f04e4849cb794d547b6983a1\` FOREIGN KEY (\`department_head_id\`) REFERENCES \`members\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_3eee8d9bac20dbabce411c52f4f\` FOREIGN KEY (\`department_id\`) REFERENCES \`departments\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_6259d4592d7c24fca9fb21f7938\` FOREIGN KEY (\`reporting_manager_id\`) REFERENCES \`members\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_62933351fdb38047703e3b8d1e5\` FOREIGN KEY (\`designation_id\`) REFERENCES \`designations\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_a9e0bf4c88d3885191d5385022b\` FOREIGN KEY (\`location_id\`) REFERENCES \`locations\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_a595b5a2db232be2233684ca05b\` FOREIGN KEY (\`employment_type_id\`) REFERENCES \`employement_types\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_aae2956f6114f0dd9fbe76e567c\` FOREIGN KEY (\`hiring_source_id\`) REFERENCES \`hiring_sources\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_438c781d1af76adc5cc6d9d1d1c\` FOREIGN KEY (\`eventsId\`) REFERENCES \`events\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_88cffc021429fd8f833f1c3f15a\` FOREIGN KEY (\`noticesId\`) REFERENCES \`notices\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`attendances\` ADD CONSTRAINT \`FK_4fa5236dedf60886a5d2099e926\` FOREIGN KEY (\`location_id\`) REFERENCES \`locations\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`leaves\` ADD CONSTRAINT \`FK_6c9e43bf1012677777c1d8de6af\` FOREIGN KEY (\`approver_owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`leaves\` ADD CONSTRAINT \`FK_c37c05ad776088b265793ecb9c9\` FOREIGN KEY (\`approver_member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        if (await queryRunner.hasTable('access_roles')) {
            try {
                await queryRunner.query(`ALTER TABLE \`access_roles\` ADD CONSTRAINT \`FK_865a3eba106030747f582005591\` FOREIGN KEY (\`owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
            }
            catch (e) { }
        }
        if (await queryRunner.hasTable('role_permissions')) {
            try {
                await queryRunner.query(`ALTER TABLE \`role_permissions\` ADD CONSTRAINT \`FK_178199805b901ccd220ab7740ec\` FOREIGN KEY (\`role_id\`) REFERENCES \`access_roles\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
            }
            catch (e) { }
        }
    }
    async down(queryRunner) {
        await queryRunner.query(`ALTER TABLE \`role_permissions\` DROP FOREIGN KEY \`FK_178199805b901ccd220ab7740ec\``);
        await queryRunner.query(`ALTER TABLE \`access_roles\` DROP FOREIGN KEY \`FK_865a3eba106030747f582005591\``);
        await queryRunner.query(`ALTER TABLE \`leaves\` DROP FOREIGN KEY \`FK_c37c05ad776088b265793ecb9c9\``);
        await queryRunner.query(`ALTER TABLE \`leaves\` DROP FOREIGN KEY \`FK_6c9e43bf1012677777c1d8de6af\``);
        await queryRunner.query(`ALTER TABLE \`attendances\` DROP FOREIGN KEY \`FK_4fa5236dedf60886a5d2099e926\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_88cffc021429fd8f833f1c3f15a\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_438c781d1af76adc5cc6d9d1d1c\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_aae2956f6114f0dd9fbe76e567c\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_a595b5a2db232be2233684ca05b\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_a9e0bf4c88d3885191d5385022b\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_62933351fdb38047703e3b8d1e5\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_6259d4592d7c24fca9fb21f7938\``);
        await queryRunner.query(`ALTER TABLE \`members\` DROP FOREIGN KEY \`FK_3eee8d9bac20dbabce411c52f4f\``);
        await queryRunner.query(`ALTER TABLE \`departments\` DROP FOREIGN KEY \`FK_200f04e4849cb794d547b6983a1\``);
        await queryRunner.query(`DROP INDEX \`IDX_064de54701f3ac10466efa130a\` ON \`role_permissions\``);
        await queryRunner.query(`DROP INDEX \`IDX_9c18d618c2563fd5fa913c22d4\` ON \`access_roles\``);
        await queryRunner.query(`ALTER TABLE \`role_permissions\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`role_permissions\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`access_roles\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`access_roles\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`notification_receivers\` CHANGE \`read_at\` \`read_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP()`);
        await queryRunner.query(`ALTER TABLE \`notification_targets\` DROP COLUMN \`target_value\``);
        await queryRunner.query(`ALTER TABLE \`notification_targets\` ADD \`target_value\` longtext COLLATE "utf8mb4_bin" NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`notifications\` DROP COLUMN \`meta\``);
        await queryRunner.query(`ALTER TABLE \`notifications\` ADD \`meta\` longtext COLLATE "utf8mb4_bin" NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`notifications\` CHANGE \`source_id\` \`source_id\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`holidays\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`holidays\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`holidays\` CHANGE \`end_date\` \`end_date\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP()`);
        await queryRunner.query(`ALTER TABLE \`holidays\` CHANGE \`start_date\` \`start_date\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP()`);
        await queryRunner.query(`ALTER TABLE \`leaves\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`leaves\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`leaves\` CHANGE \`approved_at\` \`approved_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP()`);
        await queryRunner.query(`ALTER TABLE \`leaves\` CHANGE \`approver_member_id\` \`approver_member_id\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`leaves\` CHANGE \`approver_owner_id\` \`approver_owner_id\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`leaves\` CHANGE \`approver_type\` \`approver_type\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`leaves\` ADD CONSTRAINT \`FK_c37c05ad776088b265793ecb9c9\` FOREIGN KEY (\`approver_member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`leaves\` ADD CONSTRAINT \`FK_6c9e43bf1012677777c1d8de6af\` FOREIGN KEY (\`approver_owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`checkout_reminder_sent_at\` \`checkout_reminder_sent_at\` timestamp NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`location_id\` \`location_id\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`lunch_end\` \`lunch_end\` datetime NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`lunch_start\` \`lunch_start\` datetime NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`check_out\` \`check_out\` datetime NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`attendances\` CHANGE \`check_in\` \`check_in\` datetime NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`attendances\` ADD CONSTRAINT \`FK_4fa5236dedf60886a5d2099e926\` FOREIGN KEY (\`location_id\`) REFERENCES \`locations\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`attendance_breaks\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`attendance_breaks\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`attendance_breaks\` CHANGE \`break_reminder_sent_at\` \`break_reminder_sent_at\` timestamp NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`attendance_breaks\` CHANGE \`break_end\` \`break_end\` datetime NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`educations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`educations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`educations\` CHANGE \`end_date\` \`end_date\` datetime NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`work_experiences\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`work_experiences\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`work_experiences\` CHANGE \`end_date\` \`end_date\` datetime NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`noticesId\` \`noticesId\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`eventsId\` \`eventsId\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`reporting_manager_id\` \`reporting_manager_id\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`hiring_source_id\` \`hiring_source_id\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`employment_type_id\` \`employment_type_id\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`location_id\` \`location_id\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`designation_id\` \`designation_id\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`department_id\` \`department_id\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`date_of_joining\` \`date_of_joining\` datetime NULL DEFAULT CURRENT_TIMESTAMP()`);
        await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`date_of_birth\` \`date_of_birth\` datetime NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_88cffc021429fd8f833f1c3f15a\` FOREIGN KEY (\`noticesId\`) REFERENCES \`notices\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_438c781d1af76adc5cc6d9d1d1c\` FOREIGN KEY (\`eventsId\`) REFERENCES \`events\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_6259d4592d7c24fca9fb21f7938\` FOREIGN KEY (\`reporting_manager_id\`) REFERENCES \`members\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_aae2956f6114f0dd9fbe76e567c\` FOREIGN KEY (\`hiring_source_id\`) REFERENCES \`hiring_sources\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_a595b5a2db232be2233684ca05b\` FOREIGN KEY (\`employment_type_id\`) REFERENCES \`employement_types\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_a9e0bf4c88d3885191d5385022b\` FOREIGN KEY (\`location_id\`) REFERENCES \`locations\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_62933351fdb38047703e3b8d1e5\` FOREIGN KEY (\`designation_id\`) REFERENCES \`designations\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`members\` ADD CONSTRAINT \`FK_3eee8d9bac20dbabce411c52f4f\` FOREIGN KEY (\`department_id\`) REFERENCES \`departments\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`notices\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`notices\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`notices\` CHANGE \`expire_at\` \`expire_at\` datetime NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`notices\` CHANGE \`published_at\` \`published_at\` datetime NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`events\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`events\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`events\` CHANGE \`end_time\` \`end_time\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP()`);
        await queryRunner.query(`ALTER TABLE \`events\` CHANGE \`start_time\` \`start_time\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP()`);
        await queryRunner.query(`ALTER TABLE \`events\` CHANGE \`date\` \`date\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP()`);
        await queryRunner.query(`ALTER TABLE \`hiring_sources\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`hiring_sources\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`employement_types\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`employement_types\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`locations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`locations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`designations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`designations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`departments\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`departments\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`departments\` CHANGE \`department_head_id\` \`department_head_id\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`departments\` ADD CONSTRAINT \`FK_200f04e4849cb794d547b6983a1\` FOREIGN KEY (\`department_head_id\`) REFERENCES \`members\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`leave_policy\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`leave_policy\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`working_schedule\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`working_schedule\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`working_schedule\` CHANGE \`office_end_time\` \`office_end_time\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP()`);
        await queryRunner.query(`ALTER TABLE \`working_schedule\` CHANGE \`office_start_time\` \`office_start_time\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP()`);
        await queryRunner.query(`ALTER TABLE \`company\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`company\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`company\` CHANGE \`founded_at\` \`founded_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP()`);
        await queryRunner.query(`ALTER TABLE \`owner\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`owner\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await queryRunner.query(`ALTER TABLE \`owner\` CHANGE \`otp\` \`otp\` varchar(191) NULL DEFAULT 'NULL'`);
        await queryRunner.query(`ALTER TABLE \`members\` DROP COLUMN \`access_role_id\``);
        await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_role_permissions_role_key\` ON \`role_permissions\` (\`role_id\`, \`permission_key\`)`);
        await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_access_roles_owner_slug\` ON \`access_roles\` (\`owner_id\`, \`slug\`)`);
        await queryRunner.query(`ALTER TABLE \`role_permissions\` ADD CONSTRAINT \`FK_role_permissions_role\` FOREIGN KEY (\`role_id\`) REFERENCES \`access_roles\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`access_roles\` ADD CONSTRAINT \`FK_access_roles_owner\` FOREIGN KEY (\`owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
    }
}
exports.NewDatabaseConnection1780738512641 = NewDatabaseConnection1780738512641;
//# sourceMappingURL=1780738512641-NewDatabaseConnection.js.map