migrations/Version20210127130941.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Application\Migrations;
  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 Version20210127130941 extends AbstractMigration
  10. {
  11.     public function up(Schema $schema): void
  12.     {
  13.         // this up() migration is auto-generated, please modify it to your needs
  14.         $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
  15.         $this->addSql('ALTER TABLE substance_definition ADD transfer_id INT DEFAULT NULL, CHANGE cease_of_manufacturer_ts cease_of_manufacturer_ts DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE updated_at updated_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE tonnage_band_proof_timestamp tonnage_band_proof_timestamp DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE tonnage_band_proof_approved_at tonnage_band_proof_approved_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\'');
  16.         $this->addSql('ALTER TABLE substance_definition ADD CONSTRAINT FK_282BEF2F537048AF FOREIGN KEY (transfer_id) REFERENCES legal_entity_staff_request (id)');
  17.         $this->addSql('CREATE INDEX IDX_282BEF2F537048AF ON substance_definition (transfer_id)');
  18.     }
  19.     public function down(Schema $schema): void
  20.     {
  21.         // this down() migration is auto-generated, please modify it to your needs
  22.         $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
  23.         $this->addSql('ALTER TABLE substance_definition DROP FOREIGN KEY FK_282BEF2F537048AF');
  24.         $this->addSql('DROP INDEX IDX_282BEF2F537048AF ON substance_definition');
  25.         $this->addSql('ALTER TABLE substance_definition DROP transfer_id, CHANGE cease_of_manufacturer_ts cease_of_manufacturer_ts DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE updated_at updated_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE tonnage_band_proof_approved_at tonnage_band_proof_approved_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE tonnage_band_proof_timestamp tonnage_band_proof_timestamp DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\'');
  26.     }
  27. }