<?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 Version20240405131431 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 historique ADD entreprise_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE historique ADD CONSTRAINT FK_EDBFD5ECA4AEAFEA FOREIGN KEY (entreprise_id) REFERENCES entreprise (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_EDBFD5ECA4AEAFEA ON historique (entreprise_id)');
$this->addSql('UPDATE historique SET entreprise_id = 1');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE historique DROP FOREIGN KEY FK_EDBFD5ECA4AEAFEA');
$this->addSql('DROP INDEX IDX_EDBFD5ECA4AEAFEA ON historique');
$this->addSql('ALTER TABLE historique DROP entreprise_id');
}
}