<?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 Version20240812080307 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql("CREATE TABLE dp_workorder_data_history (
id INT AUTO_INCREMENT PRIMARY KEY,
workorder_id INT NOT NULL,
quantity INT NOT NULL,
data_id INT DEFAULT NULL,
level_id INT NOT NULL,
data_date DATETIME NOT NULL,
is_deleted TINYINT(1) DEFAULT 0,
created_by INT NOT NULL,
created_at DATETIME NOT NULL,
updated_by INT DEFAULT NULL,
updated_at DATETIME DEFAULT NULL,
deleted_at DATETIME DEFAULT NULL,
FOREIGN KEY (workorder_id) REFERENCES dp_workorder(id) ON DELETE RESTRICT,
FOREIGN KEY (data_id) REFERENCES dp_data(data_id) ON DELETE SET NULL,
FOREIGN KEY (level_id) REFERENCES dp_levels(level_id) ON DELETE RESTRICT,
FOREIGN KEY (created_by) REFERENCES user(id) ON DELETE RESTRICT,
FOREIGN KEY (updated_by) REFERENCES user(id) ON DELETE RESTRICT
)");
$this->addSql("UPDATE `dp_levels` SET `board_identifier` = 'smt_level' WHERE `dp_levels`.`level_id` = 17");
$this->addSql("UPDATE `dp_levels` SET `board_identifier` = 'assy_level' WHERE `dp_levels`.`level_id` = 18");
$this->addSql("UPDATE `dp_operational_unit` SET `op_ut_name` = 'ASSY' WHERE `dp_operational_unit`.`op_ut_id` = 31");
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE dp_workorder_history');
$this->addSql("UPDATE `dp_levels` SET `board_identifier` = 'smt-level' WHERE `dp_levels`.`level_id` = 17");
$this->addSql("UPDATE `dp_levels` SET `board_identifier` = 'assy-level' WHERE `dp_levels`.`level_id` = 18");
$this->addSql("UPDATE `dp_operational_unit` SET `op_ut_name` = 'Assy' WHERE `dp_operational_unit`.`op_ut_id` = 31");
}
}