<?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 Version20261020152616 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 MarkupStrategyExchangeRate (id INT AUTO_INCREMENT NOT NULL, currencyFrom VARCHAR(64) NOT NULL, currencyTo VARCHAR(64) NOT NULL, exchangeRateSale NUMERIC(10, 5) NOT NULL, createdAt DATETIME NOT NULL, updatedAt DATETIME NOT NULL, markupStrategy_id INT NOT NULL, INDEX IDX_4B3F01D9E9E26F24 (markupStrategy_id), UNIQUE INDEX UNIQ_4B3F01D9E9E26F2486C98FAFF9BEBE1E (markupStrategy_id, currencyFrom, currencyTo), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE payment_method_setting (id INT AUTO_INCREMENT NOT NULL, segment VARCHAR(10) NOT NULL, method VARCHAR(30) NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX uniq_segment_method (segment, method), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE payment_method_setting_terminal (paymentmethodsetting_id INT NOT NULL, paymentterminal_id INT NOT NULL, INDEX IDX_4A07FB27C71D8206 (paymentmethodsetting_id), INDEX IDX_4A07FB27B1C61D45 (paymentterminal_id), PRIMARY KEY(paymentmethodsetting_id, paymentterminal_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE MarkupStrategyExchangeRate ADD CONSTRAINT FK_4B3F01D9E9E26F24 FOREIGN KEY (markupStrategy_id) REFERENCES MarkupStrategy (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE payment_method_setting_terminal ADD CONSTRAINT FK_4A07FB27C71D8206 FOREIGN KEY (paymentmethodsetting_id) REFERENCES payment_method_setting (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE payment_method_setting_terminal ADD CONSTRAINT FK_4A07FB27B1C61D45 FOREIGN KEY (paymentterminal_id) REFERENCES PaymentTerminal (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE CurrencyExchangerate ADD exchangeRateSale NUMERIC(10, 5) NOT NULL, CHANGE exchangeRate exchangeRateBuy NUMERIC(10, 5) NOT NULL');
$this->addSql('ALTER TABLE OrderLine ADD hcn VARCHAR(255) DEFAULT NULL, ADD buyExchangeRatePurchaseToSale NUMERIC(10, 3) DEFAULT NULL, ADD payment_option VARCHAR(20) DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE MarkupStrategyExchangeRate DROP FOREIGN KEY FK_4B3F01D9E9E26F24');
$this->addSql('ALTER TABLE payment_method_setting_terminal DROP FOREIGN KEY FK_4A07FB27C71D8206');
$this->addSql('ALTER TABLE payment_method_setting_terminal DROP FOREIGN KEY FK_4A07FB27B1C61D45');
$this->addSql('DROP TABLE MarkupStrategyExchangeRate');
$this->addSql('DROP TABLE payment_method_setting');
$this->addSql('DROP TABLE payment_method_setting_terminal');
$this->addSql('ALTER TABLE CurrencyExchangerate ADD exchangeRate NUMERIC(10, 5) NOT NULL, DROP exchangeRateBuy, DROP exchangeRateSale');
$this->addSql('ALTER TABLE OrderLine DROP hcn, DROP buyExchangeRatePurchaseToSale, DROP payment_option');
}
}