api/src/Migrations/Version20210224085058.php
<?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 Version20210224085058 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 event ADD app_id INT DEFAULT NULL, CHANGE user_id user_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA77987212D FOREIGN KEY (app_id) REFERENCES app (id)');
$this->addSql('CREATE INDEX IDX_3BAE0AA77987212D ON event (app_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 event DROP FOREIGN KEY FK_3BAE0AA77987212D');
$this->addSql('DROP INDEX IDX_3BAE0AA77987212D ON event');
$this->addSql('ALTER TABLE event DROP app_id, CHANGE user_id user_id INT NOT NULL');
}
}