migrations/Version20240509152204.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20240509152204 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $this->addSql('ALTER TABLE tbl_cage_lapin ADD CONSTRAINT FK_90E5867AD5E86FF FOREIGN KEY (etat_id) REFERENCES ref_etat_cage_lapin (id)');
  21.         $this->addSql('ALTER TABLE tbl_lapin_production ADD cage_id INT DEFAULT NULL AFTER numero');
  22.         $this->addSql('ALTER TABLE tbl_lapin_production ADD CONSTRAINT FK_FA8825F25A70E5B7 FOREIGN KEY (cage_id) REFERENCES tbl_cage_lapin (id)');
  23.         $this->addSql('CREATE INDEX IDX_FA8825F25A70E5B7 ON tbl_lapin_production (cage_id)');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('ALTER TABLE tbl_lapin_production DROP FOREIGN KEY FK_FA8825F25A70E5B7');
  29.         $this->addSql('ALTER TABLE tbl_cage_lapin DROP FOREIGN KEY FK_90E5867AD5E86FF');
  30.         $this->addSql('DROP TABLE ref_etat_cage_lapin');
  31.         $this->addSql('DROP TABLE tbl_cage_lapin');
  32.         
  33.     }
  34. }