migrations/Version20200904204043.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 Version20200904204043 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  19.         $this->addSql('ALTER TABLE fairsIncomingStockMovements DROP FOREIGN KEY FK_E5A3FECFF125A79E');
  20.         $this->addSql('ALTER TABLE fairsOutgoingStockMovements DROP FOREIGN KEY FK_8FAD4686F125A79E');
  21.         $this->addSql('ALTER TABLE fairsIncomingStockMovements DROP FOREIGN KEY FK_E5A3FECFB10246A3');
  22.         $this->addSql('ALTER TABLE fairsOutgoingStockMovements DROP FOREIGN KEY FK_8FAD4686B10246A3');
  23.         $this->addSql('DROP TABLE fairs');
  24.         $this->addSql('DROP TABLE fairsIncomingStockMovements');
  25.         $this->addSql('DROP TABLE fairsOutgoingStockMovements');
  26.     }
  27.     public function down(Schema $schema) : void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  31.         $this->addSql('CREATE TABLE fairs (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(100) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, date DATETIME NOT NULL, endDate DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  32.         $this->addSql('CREATE TABLE fairsOutgoingStockMovements (fairId INT NOT NULL, movementId INT NOT NULL, INDEX IDX_8FAD4686F125A79E (movementId), INDEX IDX_8FAD4686B10246A3 (fairId), PRIMARY KEY(fairId, movementId)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  33.         $this->addSql('CREATE TABLE fairsIncomingStockMovements (fairId INT NOT NULL, movementId INT NOT NULL, INDEX IDX_E5A3FECFF125A79E (movementId), INDEX IDX_E5A3FECFB10246A3 (fairId), PRIMARY KEY(fairId, movementId)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  34.         $this->addSql('ALTER TABLE fairsOutgoingStockMovements ADD CONSTRAINT FK_8FAD4686B10246A3 FOREIGN KEY (fairId) REFERENCES fairs (id)');
  35.         $this->addSql('ALTER TABLE fairsOutgoingStockMovements ADD CONSTRAINT FK_8FAD4686F125A79E FOREIGN KEY (movementId) REFERENCES baseProductMovements (id)');
  36.         $this->addSql('ALTER TABLE fairsIncomingStockMovements ADD CONSTRAINT FK_E5A3FECFB10246A3 FOREIGN KEY (fairId) REFERENCES fairs (id)');
  37.         $this->addSql('ALTER TABLE fairsIncomingStockMovements ADD CONSTRAINT FK_E5A3FECFF125A79E FOREIGN KEY (movementId) REFERENCES baseProductMovements (id)');
  38.     }
  39. }