"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NewDatabaseConnection1787932451637 = void 0;
class NewDatabaseConnection1787932451637 {
    constructor() {
        this.name = 'NewDatabaseConnection1787932451637';
    }
    async safeQuery(queryRunner, query) {
        try {
            await queryRunner.query(query);
        }
        catch (e) {
        }
    }
    async up(queryRunner) {
        await this.safeQuery(queryRunner, `SET FOREIGN_KEY_CHECKS = 0;`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP FOREIGN KEY \`FK_2356832877cbc5cf26aca84e198\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`FK_members_access_role\` ON \`members\``);
        await this.safeQuery(queryRunner, `CREATE TABLE \`work_day_schedules\` (\`id\` varchar(36) NOT NULL, \`owner_id\` varchar(191) NOT NULL, \`day_of_week\` int NOT NULL, \`is_active\` tinyint NOT NULL DEFAULT 1, \`start_time\` varchar(5) NOT NULL DEFAULT '09:00', \`end_time\` varchar(5) NOT NULL DEFAULT '17:00', \`break_start\` varchar(5) NULL, \`break_end\` varchar(5) NULL, \`grace_period_minutes\` int NOT NULL DEFAULT '15', \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3), INDEX \`IDX_7af50e7aa87bff4391cf034e83\` (\`owner_id\`), UNIQUE INDEX \`IDX_ca3f2cf571368e6257a71e1286\` (\`owner_id\`, \`day_of_week\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
        await this.safeQuery(queryRunner, `CREATE TABLE \`ip_whitelists\` (\`id\` varchar(36) NOT NULL, \`owner_id\` varchar(191) NOT NULL, \`label\` varchar(191) NOT NULL, \`ip_or_cidr\` varchar(191) NOT NULL, \`is_active\` tinyint NOT NULL DEFAULT 1, \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3), INDEX \`IDX_23fbf2b1abf29274405b644071\` (\`owner_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
        await this.safeQuery(queryRunner, `CREATE TABLE \`qr_attendance_points\` (\`id\` varchar(36) NOT NULL, \`owner_id\` varchar(191) NOT NULL, \`label\` varchar(191) NOT NULL, \`code\` varchar(255) NOT NULL, \`is_active\` tinyint NOT NULL DEFAULT 1, \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3), UNIQUE INDEX \`IDX_ccfbff11b850bd44eee9f7b131\` (\`code\`), INDEX \`IDX_73b58492d11535c5577c41d156\` (\`owner_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
        await this.safeQuery(queryRunner, `CREATE TABLE \`teacher_devices\` (\`id\` varchar(36) NOT NULL, \`member_id\` varchar(191) NOT NULL, \`owner_id\` varchar(191) NOT NULL, \`device_id\` varchar(255) NOT NULL, \`device_name\` varchar(255) NULL, \`last_ip\` varchar(191) NULL, \`bound_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, \`last_active_at\` datetime NULL, \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3), INDEX \`IDX_65f82eb754f86beb547edee782\` (\`owner_id\`), INDEX \`IDX_f3426ec261dcd7dd0774732280\` (\`device_id\`), UNIQUE INDEX \`IDX_2e2b8de01639377cb08c307198\` (\`member_id\`), UNIQUE INDEX \`REL_2e2b8de01639377cb08c307198\` (\`member_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
        await this.safeQuery(queryRunner, `CREATE TABLE \`device_change_requests\` (\`id\` varchar(36) NOT NULL, \`member_id\` varchar(191) NOT NULL, \`owner_id\` varchar(191) NOT NULL, \`old_device_id\` varchar(255) NOT NULL, \`new_device_id\` varchar(255) NOT NULL, \`new_device_name\` varchar(255) NULL, \`reason\` text NULL, \`status\` enum ('pending', 'approved', 'rejected') NOT NULL DEFAULT 'pending', \`reviewed_by_id\` varchar(191) NULL, \`reviewed_at\` datetime NULL, \`admin_note\` text NULL, \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3), INDEX \`IDX_46ba04941edea256436361cb70\` (\`owner_id\`, \`status\`), INDEX \`IDX_d6324ca6dd7c57b7bf73b93b30\` (\`member_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
        await this.safeQuery(queryRunner, `CREATE TABLE \`final_settlements\` (\`id\` varchar(36) NOT NULL, \`offboarding_case_id\` varchar(191) NOT NULL, \`member_id\` varchar(191) NOT NULL, \`status\` enum ('draft', 'calculated', 'under_review', 'approved', 'included_in_payroll', 'paid', 'cancelled') NOT NULL DEFAULT 'draft', \`calculation_date\` datetime NULL, \`approved_at\` datetime NULL, \`approved_by_id\` varchar(191) NULL, \`gross_settlement\` decimal(12,2) NOT NULL DEFAULT '0.00', \`total_deductions\` decimal(12,2) NOT NULL DEFAULT '0.00', \`net_settlement\` decimal(12,2) NOT NULL DEFAULT '0.00', \`notes\` text NULL, \`owner_id\` varchar(191) NOT NULL, \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3), INDEX \`IDX_026c9fa9f4b4785c016c3850f7\` (\`status\`), INDEX \`IDX_e2f7c6c39b76a619e54d3c16e9\` (\`member_id\`), INDEX \`IDX_e2591ca208fbc53b3e82b9f28c\` (\`offboarding_case_id\`), INDEX \`IDX_209e67b31458270c98fa013e35\` (\`owner_id\`), UNIQUE INDEX \`REL_e2591ca208fbc53b3e82b9f28c\` (\`offboarding_case_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`lunch_start\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`lunch_end\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`total_break_hours\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`checkout_note\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`checkout_reminder_sent\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`checkout_reminder_sent_at\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`break_hours\` float NOT NULL DEFAULT '0'`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`net_hours\` float NOT NULL DEFAULT '0'`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`check_in_ip\` varchar(191) NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`check_out_ip\` varchar(191) NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`device_id\` varchar(255) NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`attendance_method\` varchar(32) NOT NULL DEFAULT 'manual'`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`qr_point_id\` varchar(191) NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`owner\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`owner\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`company\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`company\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`working_schedule\` CHANGE \`working_days\` \`working_days\` json NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`working_schedule\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`working_schedule\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`leave_policy\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`leave_policy\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`departments\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`departments\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`designations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`designations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`locations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`locations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`employement_types\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`employement_types\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`hiring_sources\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`hiring_sources\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`events\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`events\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`notices\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`notices\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`members\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`members\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`work_experiences\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`work_experiences\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`educations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`educations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_4dae00a2b57f002bb7e2163205\` ON \`attendances\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`date\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`date\` date NOT NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` CHANGE \`work_hours\` \`work_hours\` float NOT NULL DEFAULT '0'`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` CHANGE \`overtime_hours\` \`overtime_hours\` float NOT NULL DEFAULT '0'`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`leaves\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`leaves\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`holidays\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`holidays\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`notifications\` CHANGE \`start_time\` \`start_time\` datetime NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`notifications\` CHANGE \`end_time\` \`end_time\` datetime NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`notifications\` CHANGE \`type\` \`type\` enum ('HOLIDAY', 'NOTICE', 'LEAVE', 'ATTENDANCE', 'RECRUITMENT') NOT NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`access_roles\` DROP FOREIGN KEY \`FK_865a3eba106030747f582005591\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_9c18d618c2563fd5fa913c22d4\` ON \`access_roles\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`access_roles\` DROP COLUMN \`owner_id\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`access_roles\` ADD \`owner_id\` varchar(191) NOT NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`role_permissions\` DROP FOREIGN KEY \`FK_178199805b901ccd220ab7740ec\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_064de54701f3ac10466efa130a\` ON \`role_permissions\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`role_permissions\` DROP COLUMN \`role_id\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`role_permissions\` ADD \`role_id\` varchar(191) NOT NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_postings\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_postings\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_applications\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_applications\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`recruitment_tasks\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`recruitment_tasks\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`tenant_api_keys\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`tenant_api_keys\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_templates\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_templates\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_template_tasks\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_template_tasks\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_cases\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_cases\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_tasks\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_tasks\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_documents\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_documents\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`provisioning_items\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`provisioning_items\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`buddy_assignments\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`buddy_assignments\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_surveys\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_surveys\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`probations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`probations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`probation_reviews\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_templates\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_templates\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_template_tasks\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_template_tasks\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_cases\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_cases\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_tasks\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_tasks\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`equipment_returns\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`equipment_returns\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`exit_interview_templates\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`exit_interview_templates\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`exit_interviews\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`exit_interviews\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`final_settlement_items\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `CREATE UNIQUE INDEX \`IDX_4dae00a2b57f002bb7e2163205\` ON \`attendances\` (\`member_id\`, \`date\`)`);
        await this.safeQuery(queryRunner, `CREATE UNIQUE INDEX \`IDX_9c18d618c2563fd5fa913c22d4\` ON \`access_roles\` (\`owner_id\`, \`slug\`)`);
        await this.safeQuery(queryRunner, `CREATE UNIQUE INDEX \`IDX_064de54701f3ac10466efa130a\` ON \`role_permissions\` (\`role_id\`, \`permission_key\`)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`work_day_schedules\` ADD CONSTRAINT \`FK_7af50e7aa87bff4391cf034e832\` FOREIGN KEY (\`owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`ip_whitelists\` ADD CONSTRAINT \`FK_23fbf2b1abf29274405b644071f\` FOREIGN KEY (\`owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`qr_attendance_points\` ADD CONSTRAINT \`FK_73b58492d11535c5577c41d156f\` FOREIGN KEY (\`owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD CONSTRAINT \`FK_2356832877cbc5cf26aca84e198\` FOREIGN KEY (\`member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`teacher_devices\` ADD CONSTRAINT \`FK_2e2b8de01639377cb08c307198f\` FOREIGN KEY (\`member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`teacher_devices\` ADD CONSTRAINT \`FK_65f82eb754f86beb547edee7826\` FOREIGN KEY (\`owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`device_change_requests\` ADD CONSTRAINT \`FK_d6324ca6dd7c57b7bf73b93b304\` FOREIGN KEY (\`member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`device_change_requests\` ADD CONSTRAINT \`FK_464a1d7cd4239cbf3f492448500\` FOREIGN KEY (\`owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`access_roles\` ADD CONSTRAINT \`FK_865a3eba106030747f582005591\` FOREIGN KEY (\`owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`role_permissions\` ADD CONSTRAINT \`FK_178199805b901ccd220ab7740ec\` FOREIGN KEY (\`role_id\`) REFERENCES \`access_roles\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_postings\` ADD CONSTRAINT \`FK_cf838f9c48f90ad76d0f2d231e5\` FOREIGN KEY (\`department_id\`) REFERENCES \`departments\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_postings\` ADD CONSTRAINT \`FK_1c15a925edd72ad7be5e24a23d8\` FOREIGN KEY (\`owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_applications\` ADD CONSTRAINT \`FK_8cb08b14a02a95de3f6e016f906\` FOREIGN KEY (\`owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`tenant_api_keys\` ADD CONSTRAINT \`FK_237cb086210e280a9b970ef8297\` FOREIGN KEY (\`owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_cases\` ADD CONSTRAINT \`FK_4abc2ff047aae8b9ba650f3cc3d\` FOREIGN KEY (\`member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_tasks\` ADD CONSTRAINT \`FK_ea6a60e2a2934a4ab31502af80a\` FOREIGN KEY (\`assigned_member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`buddy_assignments\` ADD CONSTRAINT \`FK_67b393cfc41ff53f4e81f5d544c\` FOREIGN KEY (\`member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`buddy_assignments\` ADD CONSTRAINT \`FK_301494dc0352ad511100f98978e\` FOREIGN KEY (\`buddy_member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_surveys\` ADD CONSTRAINT \`FK_57fee15257cadb2bb4c007c3aa9\` FOREIGN KEY (\`member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`probations\` ADD CONSTRAINT \`FK_4dca6f18819d45cfa75061a3a61\` FOREIGN KEY (\`member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`probations\` ADD CONSTRAINT \`FK_0670a05467025d7e7e40d7321bf\` FOREIGN KEY (\`manager_id\`) REFERENCES \`members\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_cases\` ADD CONSTRAINT \`FK_c1952ebec53e72e335f5cf4c732\` FOREIGN KEY (\`member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_tasks\` ADD CONSTRAINT \`FK_86e0b2b7658dc4c86db9e33fd98\` FOREIGN KEY (\`assigned_member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`exit_interviews\` ADD CONSTRAINT \`FK_c81b8a0bb7d3a6009a8011f47e5\` FOREIGN KEY (\`member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`final_settlements\` ADD CONSTRAINT \`FK_e2591ca208fbc53b3e82b9f28c1\` FOREIGN KEY (\`offboarding_case_id\`) REFERENCES \`offboarding_cases\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`final_settlements\` ADD CONSTRAINT \`FK_e2f7c6c39b76a619e54d3c16e98\` FOREIGN KEY (\`member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`final_settlement_items\` ADD CONSTRAINT \`FK_4c9e815bfbb9ca4259cf90f1418\` FOREIGN KEY (\`settlement_id\`) REFERENCES \`final_settlements\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `SET FOREIGN_KEY_CHECKS = 1;`);
    }
    async down(queryRunner) {
        await this.safeQuery(queryRunner, `SET FOREIGN_KEY_CHECKS = 0;`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`final_settlement_items\` DROP FOREIGN KEY \`FK_4c9e815bfbb9ca4259cf90f1418\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`final_settlements\` DROP FOREIGN KEY \`FK_e2f7c6c39b76a619e54d3c16e98\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`final_settlements\` DROP FOREIGN KEY \`FK_e2591ca208fbc53b3e82b9f28c1\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`exit_interviews\` DROP FOREIGN KEY \`FK_c81b8a0bb7d3a6009a8011f47e5\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_tasks\` DROP FOREIGN KEY \`FK_86e0b2b7658dc4c86db9e33fd98\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_cases\` DROP FOREIGN KEY \`FK_c1952ebec53e72e335f5cf4c732\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`probations\` DROP FOREIGN KEY \`FK_0670a05467025d7e7e40d7321bf\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`probations\` DROP FOREIGN KEY \`FK_4dca6f18819d45cfa75061a3a61\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_surveys\` DROP FOREIGN KEY \`FK_57fee15257cadb2bb4c007c3aa9\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`buddy_assignments\` DROP FOREIGN KEY \`FK_301494dc0352ad511100f98978e\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`buddy_assignments\` DROP FOREIGN KEY \`FK_67b393cfc41ff53f4e81f5d544c\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_tasks\` DROP FOREIGN KEY \`FK_ea6a60e2a2934a4ab31502af80a\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_cases\` DROP FOREIGN KEY \`FK_4abc2ff047aae8b9ba650f3cc3d\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`tenant_api_keys\` DROP FOREIGN KEY \`FK_237cb086210e280a9b970ef8297\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_applications\` DROP FOREIGN KEY \`FK_8cb08b14a02a95de3f6e016f906\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_postings\` DROP FOREIGN KEY \`FK_1c15a925edd72ad7be5e24a23d8\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_postings\` DROP FOREIGN KEY \`FK_cf838f9c48f90ad76d0f2d231e5\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`role_permissions\` DROP FOREIGN KEY \`FK_178199805b901ccd220ab7740ec\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`access_roles\` DROP FOREIGN KEY \`FK_865a3eba106030747f582005591\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`device_change_requests\` DROP FOREIGN KEY \`FK_464a1d7cd4239cbf3f492448500\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`device_change_requests\` DROP FOREIGN KEY \`FK_d6324ca6dd7c57b7bf73b93b304\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`teacher_devices\` DROP FOREIGN KEY \`FK_65f82eb754f86beb547edee7826\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`teacher_devices\` DROP FOREIGN KEY \`FK_2e2b8de01639377cb08c307198f\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP FOREIGN KEY \`FK_2356832877cbc5cf26aca84e198\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`qr_attendance_points\` DROP FOREIGN KEY \`FK_73b58492d11535c5577c41d156f\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`ip_whitelists\` DROP FOREIGN KEY \`FK_23fbf2b1abf29274405b644071f\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`work_day_schedules\` DROP FOREIGN KEY \`FK_7af50e7aa87bff4391cf034e832\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_064de54701f3ac10466efa130a\` ON \`role_permissions\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_9c18d618c2563fd5fa913c22d4\` ON \`access_roles\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_4dae00a2b57f002bb7e2163205\` ON \`attendances\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`final_settlement_items\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`exit_interviews\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`exit_interviews\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`exit_interview_templates\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`exit_interview_templates\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`equipment_returns\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`equipment_returns\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_tasks\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_tasks\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_cases\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_cases\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_template_tasks\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_template_tasks\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_templates\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`offboarding_templates\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`probation_reviews\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`probations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`probations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_surveys\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_surveys\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`buddy_assignments\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`buddy_assignments\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`provisioning_items\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`provisioning_items\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_documents\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_documents\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_tasks\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_tasks\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_cases\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_cases\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_template_tasks\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_template_tasks\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_templates\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`onboarding_templates\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`tenant_api_keys\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`tenant_api_keys\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`recruitment_tasks\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`recruitment_tasks\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_applications\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_applications\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_postings\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`job_postings\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`role_permissions\` DROP COLUMN \`role_id\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`role_permissions\` ADD \`role_id\` varchar(36) COLLATE "utf8mb4_general_ci" NOT NULL`);
        await this.safeQuery(queryRunner, `CREATE UNIQUE INDEX \`IDX_064de54701f3ac10466efa130a\` ON \`role_permissions\` (\`role_id\`, \`permission_key\`)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`role_permissions\` ADD CONSTRAINT \`FK_178199805b901ccd220ab7740ec\` FOREIGN KEY (\`role_id\`) REFERENCES \`access_roles\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`access_roles\` DROP COLUMN \`owner_id\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`access_roles\` ADD \`owner_id\` varchar(36) COLLATE "utf8mb4_general_ci" NOT NULL`);
        await this.safeQuery(queryRunner, `CREATE UNIQUE INDEX \`IDX_9c18d618c2563fd5fa913c22d4\` ON \`access_roles\` (\`owner_id\`, \`slug\`)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`access_roles\` ADD CONSTRAINT \`FK_865a3eba106030747f582005591\` FOREIGN KEY (\`owner_id\`) REFERENCES \`owner\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`notifications\` CHANGE \`type\` \`type\` enum COLLATE "utf8mb4_general_ci" ('HOLIDAY', 'NOTICE', 'LEAVE', 'ATTENDANCE', 'RECRUITMENT', 'ONBOARDING') NOT NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`notifications\` CHANGE \`end_time\` \`end_time\` datetime NOT NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`notifications\` CHANGE \`start_time\` \`start_time\` datetime NOT NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`holidays\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`holidays\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`leaves\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`leaves\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` CHANGE \`overtime_hours\` \`overtime_hours\` float NULL DEFAULT '0'`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` CHANGE \`work_hours\` \`work_hours\` float NULL DEFAULT '0'`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`date\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`date\` datetime NOT NULL`);
        await this.safeQuery(queryRunner, `CREATE UNIQUE INDEX \`IDX_4dae00a2b57f002bb7e2163205\` ON \`attendances\` (\`member_id\`, \`date\`)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`educations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`educations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`work_experiences\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`work_experiences\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`members\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`members\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`notices\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`notices\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`events\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`events\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`hiring_sources\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`hiring_sources\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`employement_types\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`employement_types\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`locations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`locations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`designations\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`designations\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`departments\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`departments\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`leave_policy\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`leave_policy\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`working_schedule\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`working_schedule\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`working_schedule\` CHANGE \`working_days\` \`working_days\` json NOT NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`company\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`company\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`owner\` CHANGE \`updated_at\` \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`owner\` CHANGE \`created_at\` \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`qr_point_id\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`attendance_method\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`device_id\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`check_out_ip\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`check_in_ip\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`net_hours\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` DROP COLUMN \`break_hours\``);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`checkout_reminder_sent_at\` timestamp NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`checkout_reminder_sent\` tinyint NOT NULL DEFAULT '0'`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`checkout_note\` varchar(191) COLLATE "utf8mb4_general_ci" NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`total_break_hours\` float NULL DEFAULT '0'`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`lunch_end\` datetime NULL`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD \`lunch_start\` datetime NULL`);
        await this.safeQuery(queryRunner, `DROP INDEX \`REL_e2591ca208fbc53b3e82b9f28c\` ON \`final_settlements\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_209e67b31458270c98fa013e35\` ON \`final_settlements\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_e2591ca208fbc53b3e82b9f28c\` ON \`final_settlements\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_e2f7c6c39b76a619e54d3c16e9\` ON \`final_settlements\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_026c9fa9f4b4785c016c3850f7\` ON \`final_settlements\``);
        await this.safeQuery(queryRunner, `DROP TABLE \`final_settlements\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_d6324ca6dd7c57b7bf73b93b30\` ON \`device_change_requests\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_46ba04941edea256436361cb70\` ON \`device_change_requests\``);
        await this.safeQuery(queryRunner, `DROP TABLE \`device_change_requests\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`REL_2e2b8de01639377cb08c307198\` ON \`teacher_devices\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_2e2b8de01639377cb08c307198\` ON \`teacher_devices\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_f3426ec261dcd7dd0774732280\` ON \`teacher_devices\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_65f82eb754f86beb547edee782\` ON \`teacher_devices\``);
        await this.safeQuery(queryRunner, `DROP TABLE \`teacher_devices\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_ccfbff11b850bd44eee9f7b131\` ON \`qr_attendance_points\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_73b58492d11535c5577c41d156\` ON \`qr_attendance_points\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_ccfbff11b850bd44eee9f7b131\` ON \`qr_attendance_points\``);
        await this.safeQuery(queryRunner, `DROP TABLE \`qr_attendance_points\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_23fbf2b1abf29274405b644071\` ON \`ip_whitelists\``);
        await this.safeQuery(queryRunner, `DROP TABLE \`ip_whitelists\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_ca3f2cf571368e6257a71e1286\` ON \`work_day_schedules\``);
        await this.safeQuery(queryRunner, `DROP INDEX \`IDX_7af50e7aa87bff4391cf034e83\` ON \`work_day_schedules\``);
        await this.safeQuery(queryRunner, `DROP TABLE \`work_day_schedules\``);
        await this.safeQuery(queryRunner, `CREATE INDEX \`FK_members_access_role\` ON \`members\` (\`access_role_id\`)`);
        await this.safeQuery(queryRunner, `ALTER TABLE \`attendances\` ADD CONSTRAINT \`FK_2356832877cbc5cf26aca84e198\` FOREIGN KEY (\`member_id\`) REFERENCES \`members\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
        await this.safeQuery(queryRunner, `SET FOREIGN_KEY_CHECKS = 1;`);
    }
}
exports.NewDatabaseConnection1787932451637 = NewDatabaseConnection1787932451637;
//# sourceMappingURL=1787932451637-NewDatabaseConnection.js.map