migrations/Version20220519141141.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 Version20220519141141 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 type (id INT AUTO_INCREMENT NOT NULL, titre VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE type_client (id INT AUTO_INCREMENT NOT NULL, titre VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE acte ADD type_acte_id INT DEFAULT NULL, CHANGE type etat_bien VARCHAR(255) NOT NULL');
  21.         $this->addSql('ALTER TABLE acte ADD CONSTRAINT FK_9EC413268F46D732 FOREIGN KEY (type_acte_id) REFERENCES type (id)');
  22.         $this->addSql('CREATE INDEX IDX_9EC413268F46D732 ON acte (type_acte_id)');
  23.         $this->addSql('ALTER TABLE client ADD type_client_id INT DEFAULT NULL, ADD site_web VARCHAR(255) DEFAULT NULL, ADD raison_social VARCHAR(255) DEFAULT NULL, ADD boite_postal VARCHAR(255) NOT NULL, ADD local VARCHAR(255) DEFAULT NULL, ADD registre_commercial VARCHAR(255) DEFAULT NULL, ADD etat_bien VARCHAR(255) NOT NULL');
  24.         $this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455AD2D2831 FOREIGN KEY (type_client_id) REFERENCES type_client (id)');
  25.         $this->addSql('CREATE INDEX IDX_C7440455AD2D2831 ON client (type_client_id)');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('ALTER TABLE acte DROP FOREIGN KEY FK_9EC413268F46D732');
  31.         $this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C7440455AD2D2831');
  32.         $this->addSql('DROP TABLE type');
  33.         $this->addSql('DROP TABLE type_client');
  34.         $this->addSql('DROP INDEX IDX_9EC413268F46D732 ON acte');
  35.         $this->addSql('ALTER TABLE acte DROP type_acte_id, CHANGE etat_bien type VARCHAR(255) NOT NULL');
  36.         $this->addSql('DROP INDEX IDX_C7440455AD2D2831 ON client');
  37.         $this->addSql('ALTER TABLE client DROP type_client_id, DROP site_web, DROP raison_social, DROP boite_postal, DROP local, DROP registre_commercial, DROP etat_bien');
  38.     }
  39. }