<?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 Version20241216102120 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql("ALTER TABLE `dp_scrap_reasons` ADD `level_id` INT NULL AFTER `id`;");
$this->addSql("ALTER TABLE `dp_scrap_reasons` ADD FOREIGN KEY (`level_id`) REFERENCES `dp_levels`(`level_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;");
$this->addSql("UPDATE `dp_scrap_reasons` SET `level_id` = '18', `comment` = 'FTS 1' WHERE `dp_scrap_reasons`.`id` = 1");
$this->addSql("UPDATE `dp_scrap_reasons` SET `level_id` = '18', `comment` = 'FTS 2' WHERE `dp_scrap_reasons`.`id` = 2");
$this->addSql("UPDATE `dp_scrap_reasons` SET `level_id` = '17', `comment` = 'Sigma 1' WHERE `dp_scrap_reasons`.`id` = 3");
$this->addSql("INSERT INTO `dp_scrap_reasons` (`id`, `level_id`, `comment`, `company_id`, `created_by`, `created_at`) VALUES
('4', '17', 'Sigma 2', '1', '1', '2024-12-16 09:43:10.000000'),
('5', '17', 'Sigma 3', '1', '1', '2024-12-16 09:43:10.000000'),
('6', '17', 'Sigma 4', '1', '1', '2024-12-16 09:43:10.000000'),
('7', '17', 'Sigma 5', '1', '1', '2024-12-16 09:43:10.000000'),
('8', '17', 'Sigma 6', '1', '1', '2024-12-16 09:43:10.000000')");
}
public function down(Schema $schema): void
{
$this->addSql("ALTER TABLE `dp_scrap_reasons` DROP FOREIGN KEY `dp_scrap_reasons_ibfk_3`;");
$this->addSql("ALTER TABLE `dp_scrap_reasons` DROP COLUMN `level_id`;");
$this->addSql("DELETE FROM `dp_scrap_reasons` WHERE `id` IN (4, 5, 6, 7, 8);");
}
}