Fixed migration that could be incorrectly skipped due to wrong condition being used

This commit is contained in:
Alejandro Celaya 2021-02-15 22:16:58 +01:00
parent 9247cd874e
commit 32fdb257a3

View file

@ -15,10 +15,9 @@ final class Version20210207100807 extends AbstractMigration
public function up(Schema $schema): void
{
$visits = $schema->getTable('visits');
$this->skipIf($visits->hasColumn('visited_url'));
$shortUrlId = $visits->getColumn('short_url_id');
$this->skipIf(! $shortUrlId->getNotnull());
$shortUrlId->setNotnull(false);
$visits->addColumn('visited_url', Types::STRING, [
@ -34,10 +33,9 @@ final class Version20210207100807 extends AbstractMigration
public function down(Schema $schema): void
{
$visits = $schema->getTable('visits');
$this->skipIf(! $visits->hasColumn('visited_url'));
$shortUrlId = $visits->getColumn('short_url_id');
$this->skipIf($shortUrlId->getNotnull());
$shortUrlId->setNotnull(true);
$visits->dropColumn('visited_url');
$visits->dropColumn('type');