migrations/Version20180813193410.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 Version20180813193410 extends AbstractMigration
  10. {
  11.     public function up(Schema $schema): void
  12.     {
  13.         // this up() migration is auto-generated, please modify it to your needs
  14.         $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
  15.         $this->addSql('RENAME TABLE customers_status TO customer_status');
  16.         $this->addSql('ALTER TABLE customer_status ENGINE = InnoDB');
  17.         $this->addSql('ALTER TABLE customer_status CHARACTER SET = utf8mb4');
  18.         $this->addSql('ALTER TABLE customer_status CHANGE name name VARCHAR(255) NOT NULL');
  19.         $this->addSql('RENAME TABLE customers_companies TO customer_company');
  20.         $this->addSql('ALTER TABLE customer_company ENGINE = InnoDB');
  21.         $this->addSql('ALTER TABLE customer_company CHARACTER SET = utf8mb4');
  22.         $this->addSql('
  23.             ALTER TABLE customer_company
  24.                 DROP address,
  25.                 DROP logo,
  26.                 CHANGE name name VARCHAR(255) NOT NULL
  27.         ');
  28.     }
  29.     public function down(Schema $schema): void
  30.     {
  31.         // this down() migration is auto-generated, please modify it to your needs
  32.         $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
  33.         $this->addSql('RENAME TABLE customer_status TO customers_status');
  34.         $this->addSql('ALTER TABLE customers_status ENGINE = MyISAM');
  35.         $this->addSql('ALTER TABLE customers_status CHARACTER SET = latin1');
  36.         $this->addSql('ALTER TABLE customers_status CHANGE name name VARCHAR(64) NOT NULL');
  37.         $this->addSql('RENAME TABLE customer_company TO customers_companies');
  38.         $this->addSql('ALTER TABLE customers_companies ENGINE = MyISAM');
  39.         $this->addSql('ALTER TABLE customers_companies CHARACTER SET = latin1');
  40.         $this->addSql('
  41.             ALTER TABLE customers_companies
  42.                 ADD address VARCHAR(255) DEFAULT NULL,
  43.                 ADD logo VARCHAR(255) DEFAULT NULL,
  44.                 CHANGE name name VARCHAR(64) NOT NULL
  45.         ');
  46.     }
  47. }