<?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 Version20211101220342 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('ALTER TABLE chant ADD recueil_id INT NOT NULL');
$this->addSql('ALTER TABLE chant ADD CONSTRAINT FK_3217777C31D7EA0 FOREIGN KEY (recueil_id) REFERENCES recueil (id)');
$this->addSql('CREATE INDEX IDX_3217777C31D7EA0 ON chant (recueil_id)');
$this->addSql('ALTER TABLE fichier ADD chant_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE fichier ADD CONSTRAINT FK_9B76551F1BE84489 FOREIGN KEY (chant_id) REFERENCES chant (id)');
$this->addSql('CREATE INDEX IDX_9B76551F1BE84489 ON fichier (chant_id)');
$this->addSql('ALTER TABLE programme ADD template_id INT NOT NULL');
$this->addSql('ALTER TABLE programme ADD CONSTRAINT FK_3DDCB9FF5DA0FB8 FOREIGN KEY (template_id) REFERENCES template (id)');
$this->addSql('CREATE INDEX IDX_3DDCB9FF5DA0FB8 ON programme (template_id)');
$this->addSql('ALTER TABLE programme_champ ADD template_champ_id INT NOT NULL, ADD chant_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE programme_champ ADD CONSTRAINT FK_1C7BBD7A8C7C997D FOREIGN KEY (template_champ_id) REFERENCES template_champ (id)');
$this->addSql('ALTER TABLE programme_champ ADD CONSTRAINT FK_1C7BBD7A1BE84489 FOREIGN KEY (chant_id) REFERENCES chant (id)');
$this->addSql('CREATE INDEX IDX_1C7BBD7A8C7C997D ON programme_champ (template_champ_id)');
$this->addSql('CREATE INDEX IDX_1C7BBD7A1BE84489 ON programme_champ (chant_id)');
$this->addSql('ALTER TABLE template_champ ADD template_id INT NOT NULL');
$this->addSql('ALTER TABLE template_champ ADD CONSTRAINT FK_1CB733625DA0FB8 FOREIGN KEY (template_id) REFERENCES template (id)');
$this->addSql('CREATE INDEX IDX_1CB733625DA0FB8 ON template_champ (template_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE chant DROP FOREIGN KEY FK_3217777C31D7EA0');
$this->addSql('DROP INDEX IDX_3217777C31D7EA0 ON chant');
$this->addSql('ALTER TABLE chant DROP recueil_id');
$this->addSql('ALTER TABLE fichier DROP FOREIGN KEY FK_9B76551F1BE84489');
$this->addSql('DROP INDEX IDX_9B76551F1BE84489 ON fichier');
$this->addSql('ALTER TABLE fichier DROP chant_id');
$this->addSql('ALTER TABLE programme DROP FOREIGN KEY FK_3DDCB9FF5DA0FB8');
$this->addSql('DROP INDEX IDX_3DDCB9FF5DA0FB8 ON programme');
$this->addSql('ALTER TABLE programme DROP template_id');
$this->addSql('ALTER TABLE programme_champ DROP FOREIGN KEY FK_1C7BBD7A8C7C997D');
$this->addSql('ALTER TABLE programme_champ DROP FOREIGN KEY FK_1C7BBD7A1BE84489');
$this->addSql('DROP INDEX IDX_1C7BBD7A8C7C997D ON programme_champ');
$this->addSql('DROP INDEX IDX_1C7BBD7A1BE84489 ON programme_champ');
$this->addSql('ALTER TABLE programme_champ DROP template_champ_id, DROP chant_id');
$this->addSql('ALTER TABLE template_champ DROP FOREIGN KEY FK_1CB733625DA0FB8');
$this->addSql('DROP INDEX IDX_1CB733625DA0FB8 ON template_champ');
$this->addSql('ALTER TABLE template_champ DROP template_id');
}
}