<?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 Version20180424124201 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_document ADD `id` INT NOT NULL, ADD `month` INT NOT NULL');
$this->addSql('ALTER TABLE membership_document DROP PRIMARY KEY');
$this->addSql('ALTER TABLE membership_document ADD PRIMARY KEY (`id`)');
$this->addSql('ALTER TABLE membership_document MODIFY `id` INT AUTO_INCREMENT NOT NULL');
$this->addSql('ALTER TABLE membership_survey ADD `month` INT 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('ALTER TABLE membership_document MODIFY `id` INT NOT NULL');
$this->addSql('ALTER TABLE membership_document DROP PRIMARY KEY');
$this->addSql('ALTER TABLE membership_document DROP `id`, DROP `month`');
$this->addSql('ALTER TABLE membership_document ADD PRIMARY KEY (membership_id, document_id)');
$this->addSql('ALTER TABLE membership_survey DROP `month`');
}
}