<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200410104531 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
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 user ADD username VARCHAR(255) NOT NULL, CHANGE state status TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE tracking DROP INDEX UNIQ_A87C621CA76ED395, ADD INDEX IDX_A87C621CA76ED395 (user_id)');
$this->addSql('ALTER TABLE tracking ADD project_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE tracking ADD CONSTRAINT FK_A87C621C166D1F9C FOREIGN KEY (project_id) REFERENCES project (id)');
$this->addSql('CREATE INDEX IDX_A87C621C166D1F9C ON tracking (project_id)');
}
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 tracking DROP INDEX IDX_A87C621CA76ED395, ADD UNIQUE INDEX UNIQ_A87C621CA76ED395 (user_id)');
$this->addSql('ALTER TABLE tracking DROP FOREIGN KEY FK_A87C621C166D1F9C');
$this->addSql('DROP INDEX IDX_A87C621C166D1F9C ON tracking');
$this->addSql('ALTER TABLE tracking DROP project_id');
$this->addSql('ALTER TABLE user DROP username, CHANGE status state TINYINT(1) NOT NULL');
}
}