<?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 Version20230808214504 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE paper_size (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, width INT NOT NULL, height INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE paper_size_machine (paper_size_id INT NOT NULL, machine_id INT NOT NULL, INDEX IDX_5AA9D1064929FAC6 (paper_size_id), INDEX IDX_5AA9D106F6B75B26 (machine_id), PRIMARY KEY(paper_size_id, machine_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE paper_size_machine ADD CONSTRAINT FK_5AA9D1064929FAC6 FOREIGN KEY (paper_size_id) REFERENCES paper_size (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE paper_size_machine ADD CONSTRAINT FK_5AA9D106F6B75B26 FOREIGN KEY (machine_id) REFERENCES machine (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE paper_size_machine DROP FOREIGN KEY FK_5AA9D1064929FAC6');
$this->addSql('ALTER TABLE paper_size_machine DROP FOREIGN KEY FK_5AA9D106F6B75B26');
$this->addSql('DROP TABLE paper_size');
$this->addSql('DROP TABLE paper_size_machine');
}
}