<?php
declare(strict_types=1);
namespace App\Migrations\Common;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220302_MerchantAttribute extends AbstractMigration
{
public function getDescription(): string
{
return 'Merchant attributes';
}
public function up(Schema $schema): void
{
$this->addSql("
CREATE TABLE merchant_attribute (
id INT AUTO_INCREMENT NOT NULL,
merchant_id INT DEFAULT NULL,
attribute ENUM('pro_features', 'approve_zero') NOT NULL COMMENT '(DC2Type:merchant_attribute)',
PRIMARY KEY(id)
) ENGINE = InnoDB;"
);
$this->addSql("
CREATE TABLE merchant_attribute_history (
id INT AUTO_INCREMENT NOT NULL,
merchant_id INT DEFAULT NULL,
attribute ENUM('pro_features', 'approve_zero') NOT NULL COMMENT '(DC2Type:merchant_attribute)',
action ENUM('add', 'remove') NOT NULL COMMENT '(DC2Type:merchant_attribute_action)',
record_datetime DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)',
PRIMARY KEY(id)
) ENGINE = InnoDB;"
);
$this->addSql("ALTER TABLE merchant_attribute ADD CONSTRAINT FK_FC2826DD6796D554 FOREIGN KEY (merchant_id) REFERENCES merchant (id);");
$this->addSql("ALTER TABLE merchant_attribute_history ADD CONSTRAINT FK_4BCC45A6796D554 FOREIGN KEY (merchant_id) REFERENCES merchant (id);");
}
public function down(Schema $schema): void
{
}
}