migrations/Version20190426150734.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 Version20190426150734 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  19.         $this->addSql('ALTER TABLE std_orders DROP FOREIGN KEY FK_866AAF6646BF9597');
  20.         $this->addSql('DROP TABLE std_payment_form');
  21.         $this->addSql('DROP TABLE std_shipping_form');
  22.         $this->addSql('DROP INDEX fk_std_orders_std_payment_form ON std_orders');
  23.         $this->addSql('ALTER TABLE std_orders ADD payment_form VARCHAR(20) DEFAULT NULL COMMENT \'Payment Form\', ADD multibanco_entity BIGINT DEFAULT NULL COMMENT \'Multibanco entity number\', ADD multibanco_reference BIGINT DEFAULT NULL COMMENT \'Multibanco reference number\', DROP payment_form_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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  29.         $this->addSql('CREATE TABLE std_payment_form (id INT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT \'Unique identifier\', name VARCHAR(50) DEFAULT NULL COLLATE utf8mb4_unicode_ci COMMENT \'Payment form description\', UNIQUE INDEX UNIQ_2560BD535E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB COMMENT = \'\' ');
  30.         $this->addSql('CREATE TABLE std_shipping_form (id INT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT \'Unique identifier\', name VARCHAR(50) DEFAULT NULL COLLATE utf8mb4_unicode_ci COMMENT \'Shipping form description\', UNIQUE INDEX UNIQ_800BE9F05E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB COMMENT = \'\' ');
  31.         $this->addSql('ALTER TABLE std_orders ADD payment_form_id INT UNSIGNED DEFAULT NULL COMMENT \'Unique identifier\', DROP payment_form, DROP multibanco_entity, DROP multibanco_reference');
  32.         $this->addSql('ALTER TABLE std_orders ADD CONSTRAINT FK_866AAF6646BF9597 FOREIGN KEY (payment_form_id) REFERENCES std_payment_form (id)');
  33.         $this->addSql('CREATE INDEX fk_std_orders_std_payment_form ON std_orders (payment_form_id)');
  34.     }
  35. }