migrations/Version20261020152616.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20261020152616 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $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');
  21.         $this->addSql('ALTER TABLE MarkupStrategyExchangeRate ADD CONSTRAINT FK_4B3F01D9E9E26F24 FOREIGN KEY (markupStrategy_id) REFERENCES MarkupStrategy (id) ON DELETE CASCADE');
  22.         $this->addSql('ALTER TABLE payment_method_setting_terminal ADD CONSTRAINT FK_4A07FB27C71D8206 FOREIGN KEY (paymentmethodsetting_id) REFERENCES payment_method_setting (id) ON DELETE CASCADE');
  23.         $this->addSql('ALTER TABLE payment_method_setting_terminal ADD CONSTRAINT FK_4A07FB27B1C61D45 FOREIGN KEY (paymentterminal_id) REFERENCES PaymentTerminal (id) ON DELETE CASCADE');
  24.         $this->addSql('ALTER TABLE CurrencyExchangerate ADD exchangeRateSale NUMERIC(10, 5) NOT NULL, CHANGE exchangeRate exchangeRateBuy NUMERIC(10, 5) NOT NULL');
  25.         $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');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('ALTER TABLE MarkupStrategyExchangeRate DROP FOREIGN KEY FK_4B3F01D9E9E26F24');
  31.         $this->addSql('ALTER TABLE payment_method_setting_terminal DROP FOREIGN KEY FK_4A07FB27C71D8206');
  32.         $this->addSql('ALTER TABLE payment_method_setting_terminal DROP FOREIGN KEY FK_4A07FB27B1C61D45');
  33.         $this->addSql('DROP TABLE MarkupStrategyExchangeRate');
  34.         $this->addSql('DROP TABLE payment_method_setting');
  35.         $this->addSql('DROP TABLE payment_method_setting_terminal');
  36.         $this->addSql('ALTER TABLE CurrencyExchangerate ADD exchangeRate NUMERIC(10, 5) NOT NULL, DROP exchangeRateBuy, DROP exchangeRateSale');
  37.         $this->addSql('ALTER TABLE OrderLine DROP hcn, DROP buyExchangeRatePurchaseToSale, DROP payment_option');
  38.     }
  39. }