<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241024122750 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
//dp_shift_dates
$this->addSql('CREATE TABLE `dp_shift_dates` (`id` INT NOT NULL AUTO_INCREMENT , `company_id` INT NOT NULL , `date` DATE NOT NULL , `start_time` TIME NULL DEFAULT NULL , `end_time` TIME NULL DEFAULT NULL , `break_time` FLOAT NULL DEFAULT NULL , `duration` FLOAT NULL DEFAULT NULL , `productive_time` FLOAT NULL DEFAULT NULL , `is_deleted` TINYINT NULL DEFAULT NULL , `deleted_by` INT NULL DEFAULT NULL , `created_at` DATETIME NULL DEFAULT NULL , `created_by` INT NULL DEFAULT NULL , `updated_at` DATETIME NULL DEFAULT NULL , `updated_by` INT NULL DEFAULT NULL , `deleted_at` DATETIME NULL DEFAULT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;');
$this->addSql('ALTER TABLE `dp_shift_dates` ADD `shift_id` INT NOT NULL AFTER `company_id`;');
$this->addSql('ALTER TABLE `dp_shift_dates` ADD `level_id` INT NOT NULL AFTER `shift_id`;');
$this->addSql('ALTER TABLE `dp_shift_dates` ADD INDEX(`company_id`, `shift_id`,`level_id`, `deleted_by`, `created_by`, `updated_by`);');
$this->addSql('ALTER TABLE `dp_shift_dates` ADD FOREIGN KEY (`company_id`) REFERENCES `company`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; ALTER TABLE `dp_shift_dates` ADD FOREIGN KEY (`shift_id`) REFERENCES `dp_shift_settings`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; ALTER TABLE `dp_shift_dates` ADD FOREIGN KEY (`created_by`) REFERENCES `user`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; ALTER TABLE `dp_shift_dates` ADD FOREIGN KEY (`updated_by`) REFERENCES `user`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; ALTER TABLE `dp_shift_dates` ADD FOREIGN KEY (`deleted_by`) REFERENCES `user`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;');
$this->addSql('ALTER TABLE `dp_shift_dates` ADD FOREIGN KEY (`level_id`) REFERENCES `dp_levels`(`level_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;');
//dp_monthly_eff_rates
$this->addSql('ALTER TABLE `dp_monthly_eff_rates` ADD `level_id` INT NULL AFTER `id`;');
$this->addSql('ALTER TABLE `dp_monthly_eff_rates` ADD INDEX(`level_id`);');
$this->addSql('ALTER TABLE `dp_monthly_eff_rates` ADD FOREIGN KEY (`level_id`) REFERENCES `dp_levels`(`level_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;');
//dp_customer_ratio
$this->addSql('ALTER TABLE `dp_customer_ratio` ADD `level_id` INT NULL AFTER `customer_id`;');
$this->addSql('ALTER TABLE `dp_customer_ratio` ADD INDEX(`level_id`);');
$this->addSql('ALTER TABLE `dp_customer_ratio` ADD FOREIGN KEY (`level_id`) REFERENCES `dp_levels`(`level_id`) ON DELETE NO ACTION ON UPDATE NO ACTION');
//dp_data
$this->addSql("ALTER TABLE `dp_data` ADD `is_edited` TINYINT NOT NULL DEFAULT '0' AFTER `data_date`;");
}
public function down(Schema $schema): void
{
//dp_shift_dates
$this->addSql('ALTER TABLE `dp_shift_dates` DROP FOREIGN KEY `dp_shift_dates_ibfk_1`;');
$this->addSql('ALTER TABLE `dp_shift_dates` DROP FOREIGN KEY `dp_shift_dates_ibfk_2`;');
$this->addSql('ALTER TABLE `dp_shift_dates` DROP FOREIGN KEY `dp_shift_dates_ibfk_3`;');
$this->addSql('ALTER TABLE `dp_shift_dates` DROP FOREIGN KEY `dp_shift_dates_ibfk_4`;');
$this->addSql('ALTER TABLE `dp_shift_dates` DROP FOREIGN KEY `dp_shift_dates_ibfk_5`;');
$this->addSql('ALTER TABLE `dp_shift_dates` DROP FOREIGN KEY `dp_shift_dates_ibfk_6`;');
$this->addSql('DROP TABLE IF EXISTS `dp_shift_dates`;');
//dp_monthly_eff_rates
$this->addSql('ALTER TABLE `dp_monthly_eff_rates` DROP FOREIGN KEY `dp_monthly_eff_rates_ibfk_4`;');
$this->addSql('ALTER TABLE `dp_monthly_eff_rates` DROP `level_id`;');
//dp_customer_ratio
$this->addSql('ALTER TABLE `dp_customer_ratio` DROP FOREIGN KEY `dp_customer_ratio_ibfk_6`;');
$this->addSql('ALTER TABLE `dp_customer_ratio` DROP `level_id`;');
//dp_data
$this->addSql("ALTER TABLE `dp_data` DROP `is_edited`;");
}
}