migrations/Version20200904214744.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 Version20200904214744 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 baseProductMovements DROP FOREIGN KEY FK_56F21D8DEFCF11C9');
  20.         $this->addSql('ALTER TABLE baseProductMovements DROP FOREIGN KEY FK_56F21D8DCDF9BDA3');
  21.         $this->addSql('DROP TABLE baseProductBatches');
  22.         $this->addSql('DROP TABLE baseProductMovements');
  23.     }
  24.     public function down(Schema $schema) : void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  28.         $this->addSql('CREATE TABLE baseProductBatches (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(100) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, plots LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci` COMMENT \'(DC2Type:array)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  29.         $this->addSql('CREATE TABLE baseProductMovements (id INT AUTO_INCREMENT NOT NULL, plotNumber VARCHAR(5) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`, furrowNumber INT DEFAULT NULL, date DATETIME NOT NULL, quantity INT NOT NULL, type VARCHAR(1) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, notes LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`, balanceAfterMovement INT NOT NULL, idBaseProduct INT DEFAULT NULL, idProvider INT DEFAULT NULL, idBatch INT DEFAULT NULL, idOrder INT DEFAULT NULL, idUser INT DEFAULT NULL, INDEX IDX_56F21D8DFE6E88D7 (idUser), INDEX IDX_56F21D8DCDF9BDA3 (idBaseProduct), INDEX IDX_56F21D8DEFCF11C9 (idBatch), INDEX IDX_56F21D8DC16759C7 (idProvider), INDEX IDX_56F21D8DE2EDD085 (idOrder), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  30.         $this->addSql('ALTER TABLE baseProductMovements ADD CONSTRAINT FK_56F21D8DC16759C7 FOREIGN KEY (idProvider) REFERENCES provider (id)');
  31.         $this->addSql('ALTER TABLE baseProductMovements ADD CONSTRAINT FK_56F21D8DCDF9BDA3 FOREIGN KEY (idBaseProduct) REFERENCES baseProducts (id)');
  32.         $this->addSql('ALTER TABLE baseProductMovements ADD CONSTRAINT FK_56F21D8DE2EDD085 FOREIGN KEY (idOrder) REFERENCES orders (id)');
  33.         $this->addSql('ALTER TABLE baseProductMovements ADD CONSTRAINT FK_56F21D8DEFCF11C9 FOREIGN KEY (idBatch) REFERENCES baseProductBatches (id)');
  34.         $this->addSql('ALTER TABLE baseProductMovements ADD CONSTRAINT FK_56F21D8DFE6E88D7 FOREIGN KEY (idUser) REFERENCES users (id)');
  35.     }
  36. }