migrations/Version20251008130630.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 Version20251008130630 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 eaf_educ_jardin_potager DROP CONSTRAINT fk_85b65ca35cb73291');
  19.         $this->addSql('ALTER TABLE educ_parcelle_commune DROP CONSTRAINT fk_5178fb435cb73291');
  20.         $this->addSql('DROP SEQUENCE educ_speculation_id_seq CASCADE');
  21.         $this->addSql('DROP TABLE educ_speculation');
  22.         $this->addSql('DROP INDEX idx_85b65ca35cb73291');
  23.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager ADD speculation VARCHAR(255) DEFAULT NULL');
  24.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager ADD unite_sup_emblave VARCHAR(255) DEFAULT NULL');
  25.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager ADD unite_qte_semence VARCHAR(255) DEFAULT NULL');
  26.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager ADD technique_diffuse VARCHAR(255) DEFAULT NULL');
  27.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager RENAME COLUMN speculation_id TO education_id');
  28.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager ADD CONSTRAINT FK_85B65CA32CA1BD71 FOREIGN KEY (education_id) REFERENCES education_nutritionnelle (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  29.         $this->addSql('CREATE INDEX IDX_85B65CA32CA1BD71 ON eaf_educ_jardin_potager (education_id)');
  30.         $this->addSql('DROP INDEX idx_5178fb435cb73291');
  31.         $this->addSql('ALTER TABLE educ_parcelle_commune ADD speculation VARCHAR(255) DEFAULT NULL');
  32.         $this->addSql('ALTER TABLE educ_parcelle_commune ADD unite_qte_recolte VARCHAR(255) DEFAULT NULL');
  33.         $this->addSql('ALTER TABLE educ_parcelle_commune DROP speculation_id');
  34.     }
  35.     public function down(Schema $schema): void
  36.     {
  37.         // this down() migration is auto-generated, please modify it to your needs
  38.         $this->addSql('CREATE SCHEMA public');
  39.         $this->addSql('CREATE SEQUENCE educ_speculation_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  40.         $this->addSql('CREATE TABLE educ_speculation (id INT NOT NULL, libelle VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
  41.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager DROP CONSTRAINT FK_85B65CA32CA1BD71');
  42.         $this->addSql('DROP INDEX IDX_85B65CA32CA1BD71');
  43.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager DROP speculation');
  44.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager DROP unite_sup_emblave');
  45.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager DROP unite_qte_semence');
  46.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager DROP technique_diffuse');
  47.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager RENAME COLUMN education_id TO speculation_id');
  48.         $this->addSql('ALTER TABLE eaf_educ_jardin_potager ADD CONSTRAINT fk_85b65ca35cb73291 FOREIGN KEY (speculation_id) REFERENCES educ_speculation (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  49.         $this->addSql('CREATE INDEX idx_85b65ca35cb73291 ON eaf_educ_jardin_potager (speculation_id)');
  50.         $this->addSql('ALTER TABLE educ_parcelle_commune ADD speculation_id INT DEFAULT NULL');
  51.         $this->addSql('ALTER TABLE educ_parcelle_commune DROP speculation');
  52.         $this->addSql('ALTER TABLE educ_parcelle_commune DROP unite_qte_recolte');
  53.         $this->addSql('ALTER TABLE educ_parcelle_commune ADD CONSTRAINT fk_5178fb435cb73291 FOREIGN KEY (speculation_id) REFERENCES educ_speculation (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  54.         $this->addSql('CREATE INDEX idx_5178fb435cb73291 ON educ_parcelle_commune (speculation_id)');
  55.     }
  56. }