<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190426150734 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE std_orders DROP FOREIGN KEY FK_866AAF6646BF9597');
$this->addSql('DROP TABLE std_payment_form');
$this->addSql('DROP TABLE std_shipping_form');
$this->addSql('DROP INDEX fk_std_orders_std_payment_form ON std_orders');
$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');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$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 = \'\' ');
$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 = \'\' ');
$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');
$this->addSql('ALTER TABLE std_orders ADD CONSTRAINT FK_866AAF6646BF9597 FOREIGN KEY (payment_form_id) REFERENCES std_payment_form (id)');
$this->addSql('CREATE INDEX fk_std_orders_std_payment_form ON std_orders (payment_form_id)');
}
}