<?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 Version20241202105555 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add user on module and ensemble';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE ensemble ADD user_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE ensemble ADD CONSTRAINT FK_8C4B40B0A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('CREATE INDEX IDX_8C4B40B0A76ED395 ON ensemble (user_id)');
$this->addSql('ALTER TABLE module ADD user_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE module ADD CONSTRAINT FK_C242628A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('CREATE INDEX IDX_C242628A76ED395 ON module (user_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE ensemble DROP FOREIGN KEY FK_8C4B40B0A76ED395');
$this->addSql('DROP INDEX IDX_8C4B40B0A76ED395 ON ensemble');
$this->addSql('ALTER TABLE ensemble DROP user_id');
$this->addSql('ALTER TABLE module DROP FOREIGN KEY FK_C242628A76ED395');
$this->addSql('DROP INDEX IDX_C242628A76ED395 ON module');
$this->addSql('ALTER TABLE module DROP user_id');
}
}