migrations/Version20240624083551.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 Version20240624083551 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('ALTER TABLE lait_traitement CHANGE nom nom VARCHAR(255) NOT NULL');
  19.         $this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_produit_categorie');
  20.         $this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_produit_lait');
  21.         $this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_produit_lait_traitement');
  22.         $this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_produit_origine');
  23.         $this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_produit_type');
  24.         $this->addSql('ALTER TABLE produit CHANGE prix_unitaire prix_unitaire DOUBLE PRECISION DEFAULT NULL, CHANGE photo photo VARCHAR(255) DEFAULT NULL');
  25.         $this->addSql('CREATE UNIQUE INDEX UNIQ_29A5EC27989D9B62 ON produit (slug)');
  26.         $this->addSql('DROP INDEX idx_29a5ec278a3c7387 ON produit');
  27.         $this->addSql('CREATE INDEX IDX_29A5EC27BCF5E72D ON produit (categorie_id)');
  28.         $this->addSql('DROP INDEX idx_29a5ec27714819a0 ON produit');
  29.         $this->addSql('CREATE INDEX IDX_29A5EC27C54C8C93 ON produit (type_id)');
  30.         $this->addSql('DROP INDEX idx_29a5ec275eb5d46a ON produit');
  31.         $this->addSql('CREATE INDEX IDX_29A5EC2787998E ON produit (origine_id)');
  32.         $this->addSql('DROP INDEX idx_29a5ec27f07485af ON produit');
  33.         $this->addSql('CREATE INDEX IDX_29A5EC27FBAD1BC5 ON produit (lait_id)');
  34.         $this->addSql('DROP INDEX IDX_29A5EC27F07486FG ON produit');
  35.         $this->addSql('CREATE INDEX IDX_29A5EC27A338A393 ON produit (lait_traitement_id)');
  36.         $this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_produit_categorie FOREIGN KEY (categorie_id) REFERENCES categorie (id) ON UPDATE NO ACTION ON DELETE SET NULL');
  37.         $this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_produit_lait FOREIGN KEY (lait_id) REFERENCES lait (id) ON UPDATE NO ACTION ON DELETE SET NULL');
  38.         $this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_produit_lait_traitement FOREIGN KEY (lait_traitement_id) REFERENCES lait_traitement (id) ON UPDATE NO ACTION ON DELETE SET NULL');
  39.         $this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_produit_origine FOREIGN KEY (origine_id) REFERENCES origine (id) ON UPDATE NO ACTION ON DELETE SET NULL');
  40.         $this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_produit_type FOREIGN KEY (type_id) REFERENCES type (id) ON UPDATE NO ACTION ON DELETE SET NULL');
  41.     }
  42.     public function down(Schema $schema): void
  43.     {
  44.         // this down() migration is auto-generated, please modify it to your needs
  45.         $this->addSql('ALTER TABLE lait_traitement CHANGE nom nom VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL COLLATE `latin1_swedish_ci`');
  46.         $this->addSql('DROP INDEX UNIQ_29A5EC27989D9B62 ON produit');
  47.         $this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_29A5EC27BCF5E72D');
  48.         $this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_29A5EC27C54C8C93');
  49.         $this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_29A5EC2787998E');
  50.         $this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_29A5EC27FBAD1BC5');
  51.         $this->addSql('ALTER TABLE produit DROP FOREIGN KEY FK_29A5EC27A338A393');
  52.         $this->addSql('ALTER TABLE produit CHANGE prix_unitaire prix_unitaire DOUBLE PRECISION NOT NULL, CHANGE photo photo VARCHAR(255) CHARACTER SET utf8mb3 NOT NULL COLLATE `utf8mb3_general_ci`');
  53.         $this->addSql('DROP INDEX idx_29a5ec2787998e ON produit');
  54.         $this->addSql('CREATE INDEX IDX_29A5EC275EB5D46A ON produit (origine_id)');
  55.         $this->addSql('DROP INDEX idx_29a5ec27c54c8c93 ON produit');
  56.         $this->addSql('CREATE INDEX IDX_29A5EC27714819A0 ON produit (type_id)');
  57.         $this->addSql('DROP INDEX idx_29a5ec27bcf5e72d ON produit');
  58.         $this->addSql('CREATE INDEX IDX_29A5EC278A3C7387 ON produit (categorie_id)');
  59.         $this->addSql('DROP INDEX idx_29a5ec27fbad1bc5 ON produit');
  60.         $this->addSql('CREATE INDEX IDX_29A5EC27F07485AF ON produit (lait_id)');
  61.         $this->addSql('DROP INDEX idx_29a5ec27a338a393 ON produit');
  62.         $this->addSql('CREATE INDEX IDX_29A5EC27F07486FG ON produit (lait_traitement_id)');
  63.         $this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_29A5EC27BCF5E72D FOREIGN KEY (categorie_id) REFERENCES categorie (id) ON DELETE SET NULL');
  64.         $this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_29A5EC27C54C8C93 FOREIGN KEY (type_id) REFERENCES type (id) ON DELETE SET NULL');
  65.         $this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_29A5EC2787998E FOREIGN KEY (origine_id) REFERENCES origine (id) ON DELETE SET NULL');
  66.         $this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_29A5EC27FBAD1BC5 FOREIGN KEY (lait_id) REFERENCES lait (id) ON DELETE SET NULL');
  67.         $this->addSql('ALTER TABLE produit ADD CONSTRAINT FK_29A5EC27A338A393 FOREIGN KEY (lait_traitement_id) REFERENCES lait_traitement (id) ON DELETE SET NULL');
  68.     }
  69. }