<?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 Version20241127121124 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql("CREATE TABLE `dp_holiday_dates` (
`id` int NOT NULL AUTO_INCREMENT,
`company_id` int NOT NULL,
`holiday_id` int NOT NULL,
`date` date NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `company_id` (`company_id`),
KEY `holiday_id` (`holiday_id`),
CONSTRAINT `dp_holiday_dates_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `company` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `dp_holiday_dates_ibfk_2` FOREIGN KEY (`holiday_id`) REFERENCES `dp_manage_holidays` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci");
$this->addSql("ALTER TABLE `dp_manage_holidays` DROP COLUMN `date`;");
}
public function down(Schema $schema): void
{
$this->addSql("DROP TABLE `dp_holiday_dates`");
$this->addSql("ALTER TABLE `dp_manage_holidays` ADD COLUMN `date` DATE NOT NULL;");
}
}