. */ namespace Application\Migrations; use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; class VersionAuthserverStats20171102211018 extends AbstractMigration { public function up(Schema $schema) { $loginEntry = $schema->getTable('vierbergenlars_stats_login_entry'); $loginEntry->removeForeignKey('vl_stats_le'); $loginEntry->getColumn('user_id')->setNotNull(false); $loginEntry->addForeignKeyConstraint('auth_users', [ 'user_id' ], [ 'id' ], [ 'onDelete' => 'SET NULL' ], 'vl_stats_le'); } public function down(Schema $schema) { $loginEntry = $schema->getTable('vierbergenlars_stats_login_entry'); $loginEntry->removeForeignKey('vl_stats_le'); $loginEntry->getColumn('user_id')->setNotNull(true); $loginEntry->addForeignKeyConstraint('auth_users', [ 'user_id' ], [ 'id' ], [ 'onDelete' => 'DELETE' ], 'vl_stats_le'); } }