migrations/Version20230221195401.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 Version20230221195401 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 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');
  19.         $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');
  20.         $this->addSql('ALTER TABLE seller_payment_discount ADD CONSTRAINT FK_FBE2FA698DE820D9 FOREIGN KEY (seller_id) REFERENCES seller (id)');
  21.         $this->addSql('ALTER TABLE seller_payment_discount ADD CONSTRAINT FK_FBE2FA69BAF0B1C5 FOREIGN KEY (payment_discount_id) REFERENCES payment_discount (id)');
  22.     }
  23.     public function down(Schema $schema): void
  24.     {
  25.         // this down() migration is auto-generated, please modify it to your needs
  26.         $this->addSql('ALTER TABLE seller_payment_discount DROP FOREIGN KEY FK_FBE2FA69BAF0B1C5');
  27.         $this->addSql('DROP TABLE payment_discount');
  28.         $this->addSql('DROP TABLE seller_payment_discount');
  29.     }
  30. }