for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Application\Migration;
use Doctrine\DBAL\Schema\Schema;
class Version20190128093129 extends AbstractMigration
{
public function up(Schema $schema): void
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FE92F8F78');
$this->addSql('ALTER TABLE message ADD email VARCHAR(191) NOT NULL, CHANGE recipient_id recipient_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FE92F8F78 FOREIGN KEY (recipient_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE user ADD token VARCHAR(32) DEFAULT NULL, ADD token_creation_date DATETIME DEFAULT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D6495F37A13B ON user (token)');
}