migrations/Version20180404071318.php line 1

Open in your IDE?
  1. <?php declare (strict_types 1);
  2. namespace DoctrineMigrations;
  3. use Doctrine\DBAL\Schema\Schema;
  4. use Doctrine\Migrations\AbstractMigration;
  5. /**
  6.  * Auto-generated Migration: Please modify to your needs!
  7.  */
  8. class Version20180404071318 extends AbstractMigration
  9. {
  10.     public function up(Schema $schema): void
  11.     {
  12.         // this up() migration is auto-generated, please modify it to your needs
  13.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  14.         $this->addSql('ALTER TABLE membership DROP FOREIGN KEY FK_86FFD285C03ACDAE');
  15.         $this->addSql('DROP TABLE user');
  16.         $this->addSql('DROP INDEX IDX_86FFD285C03ACDAE ON membership');
  17.         $this->addSql('ALTER TABLE membership ADD `user_Id` VARCHAR(255) NOT NULL, DROP user_id, CHANGE product_id `product_id` BIGINT NOT NULL');
  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($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  23.         $this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, mapped_id INT NOT NULL, description VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  24.         $this->addSql('ALTER TABLE membership ADD user_id INT NOT NULL, DROP `userId`, CHANGE `product_id` product_id INT NOT NULL');
  25.         $this->addSql('ALTER TABLE membership ADD CONSTRAINT FK_86FFD285C03ACDAE FOREIGN KEY (user_id) REFERENCES user (id)');
  26.         $this->addSql('CREATE INDEX IDX_86FFD285C03ACDAE ON membership (user_id)');
  27.     }
  28. }