migrations/Version20260429085410.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 Version20260429085410 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 tache_vehicule (taches_id INT NOT NULL, vehicule_id BIGINT NOT NULL, PRIMARY KEY(taches_id, vehicule_id))');
  19.         $this->addSql('CREATE INDEX IDX_92EEEE20B8A61670 ON tache_vehicule (taches_id)');
  20.         $this->addSql('CREATE INDEX IDX_92EEEE204A4A3511 ON tache_vehicule (vehicule_id)');
  21.         $this->addSql('ALTER TABLE tache_vehicule ADD CONSTRAINT FK_92EEEE20B8A61670 FOREIGN KEY (taches_id) REFERENCES taches (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  22.         $this->addSql('ALTER TABLE tache_vehicule ADD CONSTRAINT FK_92EEEE204A4A3511 FOREIGN KEY (vehicule_id) REFERENCES vehicule (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  23.         $this->addSql('ALTER TABLE vehicule ADD type_energie VARCHAR(255) DEFAULT NULL');
  24.         $this->addSql('ALTER TABLE vehicule ALTER puissance_fiscale DROP NOT NULL');
  25.         $this->addSql('ALTER TABLE vehicule ALTER date_achat DROP NOT NULL');
  26.         $this->addSql('ALTER TABLE vehicule ALTER date_mise_service DROP NOT NULL');
  27.         $this->addSql('ALTER TABLE vehicule ALTER numero_carte_grise DROP NOT NULL');
  28.         $this->addSql('ALTER TABLE vehicule ALTER documents_carte_grise DROP NOT NULL');
  29.         $this->addSql('ALTER TABLE vehicule ALTER numero_contrat_assurance DROP NOT NULL');
  30.     }
  31.     public function down(Schema $schema): void
  32.     {
  33.         // this down() migration is auto-generated, please modify it to your needs
  34.         $this->addSql('CREATE SCHEMA public');
  35.         $this->addSql('ALTER TABLE tache_vehicule DROP CONSTRAINT FK_92EEEE20B8A61670');
  36.         $this->addSql('ALTER TABLE tache_vehicule DROP CONSTRAINT FK_92EEEE204A4A3511');
  37.         $this->addSql('DROP TABLE tache_vehicule');
  38.         $this->addSql('ALTER TABLE vehicule DROP type_energie');
  39.         $this->addSql('ALTER TABLE vehicule ALTER puissance_fiscale SET NOT NULL');
  40.         $this->addSql('ALTER TABLE vehicule ALTER date_achat SET NOT NULL');
  41.         $this->addSql('ALTER TABLE vehicule ALTER date_mise_service SET NOT NULL');
  42.         $this->addSql('ALTER TABLE vehicule ALTER numero_carte_grise SET NOT NULL');
  43.         $this->addSql('ALTER TABLE vehicule ALTER documents_carte_grise SET NOT NULL');
  44.         $this->addSql('ALTER TABLE vehicule ALTER numero_contrat_assurance SET NOT NULL');
  45.     }
  46. }