<?php declare (strict_types = 1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20180404071318 extends AbstractMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE membership DROP FOREIGN KEY FK_86FFD285C03ACDAE');
$this->addSql('DROP TABLE user');
$this->addSql('DROP INDEX IDX_86FFD285C03ACDAE ON membership');
$this->addSql('ALTER TABLE membership ADD `user_Id` VARCHAR(255) NOT NULL, DROP user_id, CHANGE product_id `product_id` BIGINT NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$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');
$this->addSql('ALTER TABLE membership ADD user_id INT NOT NULL, DROP `userId`, CHANGE `product_id` product_id INT NOT NULL');
$this->addSql('ALTER TABLE membership ADD CONSTRAINT FK_86FFD285C03ACDAE FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('CREATE INDEX IDX_86FFD285C03ACDAE ON membership (user_id)');
}
}