<?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 Version20220902001010 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 equivalent_matter (id INT AUTO_INCREMENT NOT NULL, establishment_id INT NOT NULL, code VARCHAR(128) NOT NULL, `label` VARCHAR(128) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_by INT NOT NULL, updated_by INT NOT NULL, INDEX IDX_842652C28565851 (establishment_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE equivalent_matter ADD CONSTRAINT FK_842652C28565851 FOREIGN KEY (establishment_id) REFERENCES establishment (id)');
$this->addSql('ALTER TABLE school_matter ADD equivalent_matter_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE school_matter ADD CONSTRAINT FK_4D6298A3AEEA3DB1 FOREIGN KEY (equivalent_matter_id) REFERENCES equivalent_matter (id)');
$this->addSql('CREATE INDEX IDX_4D6298A3AEEA3DB1 ON school_matter (equivalent_matter_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE school_matter DROP FOREIGN KEY FK_4D6298A3AEEA3DB1');
$this->addSql('DROP TABLE equivalent_matter');
$this->addSql('DROP INDEX IDX_4D6298A3AEEA3DB1 ON school_matter');
$this->addSql('ALTER TABLE school_matter DROP equivalent_matter_id');
}
}