<?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 Version20200226171114 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('CREATE TABLE orders (id INT AUTO_INCREMENT NOT NULL, price NUMERIC(10, 2) NOT NULL, price_vat NUMERIC(10, 2) NOT NULL, price_admin NUMERIC(10, 2) NOT NULL, price_admin_vat NUMERIC(10, 2) NOT NULL, quantity INT NOT NULL, state VARCHAR(64) NOT NULL, currency VARCHAR(3) NOT NULL, hash VARCHAR(128) NOT NULL, UNIQUE INDEX UNIQ_E52FFDEED1B862B8 (hash), INDEX idx_hash (hash), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE payment ADD to_order_id INT NOT NULL, ADD currency VARCHAR(3) NOT NULL');
$this->addSql('ALTER TABLE payment ADD CONSTRAINT FK_6D28840D40C6F396 FOREIGN KEY (to_order_id) REFERENCES orders (id)');
$this->addSql('CREATE INDEX IDX_6D28840D40C6F396 ON payment (to_order_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('ALTER TABLE payment DROP FOREIGN KEY FK_6D28840D40C6F396');
$this->addSql('DROP TABLE orders');
$this->addSql('DROP INDEX IDX_6D28840D40C6F396 ON payment');
$this->addSql('ALTER TABLE payment DROP to_order_id, DROP currency');
}
}