<?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 Version20230221195401 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->addSql('CREATE TABLE payment_discount (id INT AUTO_INCREMENT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, name VARCHAR(200) NOT NULL, `order` SMALLINT DEFAULT 1 NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE seller_payment_discount (id INT AUTO_INCREMENT NOT NULL, seller_id INT NOT NULL, payment_discount_id INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, discount INT DEFAULT NULL, INDEX IDX_SELLER (seller_id), INDEX IDX_PAYMENT_DISCOUNT (payment_discount_id), UNIQUE INDEX UNQ_SELLER_PAYMENT_DISCOUNT (seller_id, payment_discount_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE seller_payment_discount ADD CONSTRAINT FK_FBE2FA698DE820D9 FOREIGN KEY (seller_id) REFERENCES seller (id)');
$this->addSql('ALTER TABLE seller_payment_discount ADD CONSTRAINT FK_FBE2FA69BAF0B1C5 FOREIGN KEY (payment_discount_id) REFERENCES payment_discount (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE seller_payment_discount DROP FOREIGN KEY FK_FBE2FA69BAF0B1C5');
$this->addSql('DROP TABLE payment_discount');
$this->addSql('DROP TABLE seller_payment_discount');
}
}