migrations/Version20251002184525.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 Version20251002184525 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 profil DROP CONSTRAINT fk_e6d6b29793989168');
  19.         $this->addSql('DROP SEQUENCE type_profil_id_seq CASCADE');
  20.         $this->addSql('DROP TABLE type_profil');
  21.         $this->addSql('ALTER TABLE convention_signe DROP CONSTRAINT fk_561a2ad5d2415cf9');
  22.         $this->addSql('DROP INDEX idx_561a2ad5d2415cf9');
  23.         $this->addSql('ALTER TABLE convention_signe RENAME COLUMN type_convention_id TO activite_realisation_id');
  24.         $this->addSql('ALTER TABLE convention_signe ADD CONSTRAINT FK_561A2AD56B88DC67 FOREIGN KEY (activite_realisation_id) REFERENCES activite_realisation (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  25.         $this->addSql('CREATE INDEX IDX_561A2AD56B88DC67 ON convention_signe (activite_realisation_id)');
  26.         $this->addSql('ALTER TABLE menu DROP CONSTRAINT FK_7D053A93CCD7E912');
  27.         $this->addSql('ALTER TABLE menu ADD CONSTRAINT FK_7D053A93CCD7E912 FOREIGN KEY (menu_id) REFERENCES menu (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  28.         $this->addSql('ALTER TABLE profil DROP CONSTRAINT FK_E6D6B297B3E9C81');
  29.         $this->addSql('DROP INDEX idx_e6d6b29793989168');
  30.         $this->addSql('ALTER TABLE profil DROP type_profil_id');
  31.         $this->addSql('ALTER TABLE profil ADD CONSTRAINT FK_E6D6B297B3E9C81 FOREIGN KEY (niveau_id) REFERENCES niveau (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  32.     }
  33.     public function down(Schema $schema): void
  34.     {
  35.         // this down() migration is auto-generated, please modify it to your needs
  36.         $this->addSql('CREATE SCHEMA public');
  37.         $this->addSql('CREATE SEQUENCE type_profil_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  38.         $this->addSql('CREATE TABLE type_profil (id SERIAL NOT NULL, name VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
  39.         $this->addSql('ALTER TABLE profil DROP CONSTRAINT fk_e6d6b297b3e9c81');
  40.         $this->addSql('ALTER TABLE profil ADD type_profil_id INT DEFAULT NULL');
  41.         $this->addSql('ALTER TABLE profil ADD CONSTRAINT fk_e6d6b29793989168 FOREIGN KEY (type_profil_id) REFERENCES type_profil (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  42.         $this->addSql('ALTER TABLE profil ADD CONSTRAINT fk_e6d6b297b3e9c81 FOREIGN KEY (niveau_id) REFERENCES niveau (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  43.         $this->addSql('CREATE INDEX idx_e6d6b29793989168 ON profil (type_profil_id)');
  44.         $this->addSql('ALTER TABLE convention_signe DROP CONSTRAINT FK_561A2AD56B88DC67');
  45.         $this->addSql('DROP INDEX IDX_561A2AD56B88DC67');
  46.         $this->addSql('ALTER TABLE convention_signe RENAME COLUMN activite_realisation_id TO type_convention_id');
  47.         $this->addSql('ALTER TABLE convention_signe ADD CONSTRAINT fk_561a2ad5d2415cf9 FOREIGN KEY (type_convention_id) REFERENCES type_convention (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  48.         $this->addSql('CREATE INDEX idx_561a2ad5d2415cf9 ON convention_signe (type_convention_id)');
  49.         $this->addSql('ALTER TABLE menu DROP CONSTRAINT fk_7d053a93ccd7e912');
  50.         $this->addSql('ALTER TABLE menu ADD CONSTRAINT fk_7d053a93ccd7e912 FOREIGN KEY (menu_id) REFERENCES menu (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  51.     }
  52. }