<?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 Version20240509152204 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 ref_etat_cage_lapin (id INT AUTO_INCREMENT NOT NULL, lib VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE tbl_cage_lapin (id INT AUTO_INCREMENT NOT NULL, etat_id INT DEFAULT NULL, numero VARCHAR(255) NOT NULL, INDEX IDX_90E5867AD5E86FF (etat_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE tbl_cage_lapin ADD CONSTRAINT FK_90E5867AD5E86FF FOREIGN KEY (etat_id) REFERENCES ref_etat_cage_lapin (id)');
$this->addSql('ALTER TABLE tbl_lapin_production ADD cage_id INT DEFAULT NULL AFTER numero');
$this->addSql('ALTER TABLE tbl_lapin_production ADD CONSTRAINT FK_FA8825F25A70E5B7 FOREIGN KEY (cage_id) REFERENCES tbl_cage_lapin (id)');
$this->addSql('CREATE INDEX IDX_FA8825F25A70E5B7 ON tbl_lapin_production (cage_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE tbl_lapin_production DROP FOREIGN KEY FK_FA8825F25A70E5B7');
$this->addSql('ALTER TABLE tbl_cage_lapin DROP FOREIGN KEY FK_90E5867AD5E86FF');
$this->addSql('DROP TABLE ref_etat_cage_lapin');
$this->addSql('DROP TABLE tbl_cage_lapin');
}
}