migrations/Version20190601012252.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 Version20190601012252 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('DROP TABLE cartSubItems');
  20.         $this->addSql('DROP TABLE gatedCommunities');
  21.     }
  22.     public function down(Schema $schema) : void
  23.     {
  24.         // this down() migration is auto-generated, please modify it to your needs
  25.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  26.         $this->addSql('CREATE TABLE cartSubItems (id INT AUTO_INCREMENT NOT NULL, quantity DOUBLE PRECISION NOT NULL, saleQuantity DOUBLE PRECISION DEFAULT NULL, active TINYINT(1) DEFAULT \'1\' NOT NULL, stockMoved TINYINT(1) DEFAULT \'0\' NOT NULL, createdAt DATETIME NOT NULL, updatedAt DATETIME NOT NULL, idItem INT DEFAULT NULL, idBaseProduct INT DEFAULT NULL, updatedBy INT DEFAULT NULL, INDEX IDX_2C8862BF6CE67B80 (idItem), INDEX IDX_2C8862BFE8DE7170 (updatedBy), INDEX IDX_2C8862BFCDF9BDA3 (idBaseProduct), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB COMMENT = \'\' ');
  27.         $this->addSql('CREATE TABLE gatedCommunities (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(100) NOT NULL COLLATE utf8_unicode_ci, address VARCHAR(200) NOT NULL COLLATE utf8_unicode_ci, distance INT DEFAULT NULL, is_active TINYINT(1) NOT NULL, idDeliveryZone INT DEFAULT NULL, INDEX IDX_FB58ADD83483B996 (idDeliveryZone), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB COMMENT = \'\' ');
  28.         $this->addSql('ALTER TABLE cartSubItems ADD CONSTRAINT FK_2C8862BF6CE67B80 FOREIGN KEY (idItem) REFERENCES cartItems (id)');
  29.         $this->addSql('ALTER TABLE cartSubItems ADD CONSTRAINT FK_2C8862BFCDF9BDA3 FOREIGN KEY (idBaseProduct) REFERENCES stock_item (id)');
  30.         $this->addSql('ALTER TABLE cartSubItems ADD CONSTRAINT FK_2C8862BFE8DE7170 FOREIGN KEY (updatedBy) REFERENCES users (id)');
  31.         $this->addSql('ALTER TABLE gatedCommunities ADD CONSTRAINT FK_FB58ADD83483B996 FOREIGN KEY (idDeliveryZone) REFERENCES deliveryZones (id)');
  32.     }
  33. }