migrations/Version20220419210706.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 Version20220419210706 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('ALTER TABLE sw_product DROP FOREIGN KEY FK_A816C24876BB78EE');
  19.         $this->addSql('CREATE TABLE sw_license (id INT AUTO_INCREMENT NOT NULL, copyright VARCHAR(63) NOT NULL, relative DOUBLE PRECISION DEFAULT NULL, absolute DOUBLE PRECISION DEFAULT NULL, maximal DOUBLE PRECISION DEFAULT NULL, code VARCHAR(3) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('DROP TABLE sw_licence');
  21.         $this->addSql('DROP INDEX IDX_A816C24876BB78EE ON sw_product');
  22.         $this->addSql('ALTER TABLE sw_product CHANGE sw_licence_id sw_license_id INT DEFAULT NULL');
  23.         $this->addSql('ALTER TABLE sw_product ADD CONSTRAINT FK_A816C248165BEF6C FOREIGN KEY (sw_license_id) REFERENCES sw_license (id)');
  24.         $this->addSql('CREATE INDEX IDX_A816C248165BEF6C ON sw_product (sw_license_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 sw_product DROP FOREIGN KEY FK_A816C248165BEF6C');
  30.         $this->addSql('CREATE TABLE sw_licence (id INT AUTO_INCREMENT NOT NULL, copyright VARCHAR(63) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, relative DOUBLE PRECISION DEFAULT NULL, absolute DOUBLE PRECISION DEFAULT NULL, maximal DOUBLE PRECISION DEFAULT NULL, code VARCHAR(3) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  31.         $this->addSql('DROP TABLE sw_license');
  32.         $this->addSql('DROP INDEX IDX_A816C248165BEF6C ON sw_product');
  33.         $this->addSql('ALTER TABLE sw_product CHANGE sw_license_id sw_licence_id INT DEFAULT NULL');
  34.         $this->addSql('ALTER TABLE sw_product ADD CONSTRAINT FK_A816C24876BB78EE FOREIGN KEY (sw_licence_id) REFERENCES sw_licence (id)');
  35.         $this->addSql('CREATE INDEX IDX_A816C24876BB78EE ON sw_product (sw_licence_id)');
  36.     }
  37. }