migrations/Version20220419131634.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 Version20220419131634 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 client (id INT AUTO_INCREMENT NOT NULL, identreprise_id INT NOT NULL, ref_client VARCHAR(150) NOT NULL, raison_sociale VARCHAR(150) NOT NULL, adresse_facturation VARCHAR(100) NOT NULL, code_postale_facturation INT NOT NULL, ville_facturation LONGTEXT NOT NULL, pays_facturation LONGTEXT NOT NULL, adresse_livraison VARCHAR(100) NOT NULL, code_postal_livraison INT NOT NULL, n_tva LONGTEXT NOT NULL, adresse_mail VARCHAR(255) NOT NULL, telephone VARCHAR(100) NOT NULL, custom_field1 INT DEFAULT NULL, custom_field2 INT DEFAULT NULL, custom_field3 VARCHAR(100) DEFAULT NULL, custom_field4 VARCHAR(150) DEFAULT NULL, customfield5 DATE DEFAULT NULL, INDEX IDX_C7440455DD34B831 (identreprise_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL, available_at DATETIME NOT NULL, delivered_at DATETIME DEFAULT NULL, INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455DD34B831 FOREIGN KEY (identreprise_id) REFERENCES entreprise (id)');
  21.         $this->addSql('ALTER TABLE banque DROP FOREIGN KEY FK');
  22.         $this->addSql('ALTER TABLE banque CHANGE identreprise identreprise INT DEFAULT NULL');
  23.         $this->addSql('ALTER TABLE banque ADD CONSTRAINT FK_B1F6CB3CC0B0E75A FOREIGN KEY (identreprise) REFERENCES entreprise (id)');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('DROP TABLE client');
  29.         $this->addSql('DROP TABLE messenger_messages');
  30.         $this->addSql('ALTER TABLE banque DROP FOREIGN KEY FK_B1F6CB3CC0B0E75A');
  31.         $this->addSql('ALTER TABLE banque CHANGE identreprise identreprise INT NOT NULL');
  32.         $this->addSql('ALTER TABLE banque ADD CONSTRAINT FK FOREIGN KEY (identreprise) REFERENCES entreprise (id) ON UPDATE CASCADE ON DELETE CASCADE');
  33.     }
  34. }