migrations/Version20220810133321.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 Version20220810133321 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 addon (id INT AUTO_INCREMENT NOT NULL, tax_id INT DEFAULT NULL, is_enabled TINYINT(1) DEFAULT NULL, is_one_time TINYINT(1) DEFAULT NULL, is_system TINYINT(1) DEFAULT NULL, price NUMERIC(10, 2) NOT NULL, image_path VARCHAR(255) DEFAULT NULL, INDEX IDX_D185917FB2A824D8 (tax_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE addon_translation (id INT AUTO_INCREMENT NOT NULL, addon_id INT NOT NULL, lang VARCHAR(4) NOT NULL, name VARCHAR(255) DEFAULT NULL, short_description LONGTEXT DEFAULT NULL, description LONGTEXT DEFAULT NULL, INDEX IDX_A7C350BFCC642678 (addon_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE tax (id INT AUTO_INCREMENT NOT NULL, value NUMERIC(10, 2) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE tax_translation (id INT AUTO_INCREMENT NOT NULL, tax_id INT NOT NULL, lang VARCHAR(4) NOT NULL, name VARCHAR(255) DEFAULT NULL, INDEX IDX_3BD74C60B2A824D8 (tax_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('ALTER TABLE addon ADD CONSTRAINT FK_D185917FB2A824D8 FOREIGN KEY (tax_id) REFERENCES tax (id)');
  23.         $this->addSql('ALTER TABLE addon_translation ADD CONSTRAINT FK_A7C350BFCC642678 FOREIGN KEY (addon_id) REFERENCES addon (id)');
  24.         $this->addSql('ALTER TABLE tax_translation ADD CONSTRAINT FK_3BD74C60B2A824D8 FOREIGN KEY (tax_id) REFERENCES tax (id)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE addon_translation DROP FOREIGN KEY FK_A7C350BFCC642678');
  30.         $this->addSql('ALTER TABLE addon DROP FOREIGN KEY FK_D185917FB2A824D8');
  31.         $this->addSql('ALTER TABLE tax_translation DROP FOREIGN KEY FK_3BD74C60B2A824D8');
  32.         $this->addSql('DROP TABLE addon');
  33.         $this->addSql('DROP TABLE addon_translation');
  34.         $this->addSql('DROP TABLE tax');
  35.         $this->addSql('DROP TABLE tax_translation');
  36.     }
  37. }