Skip to content

Commit

Permalink
refactor #257 [Adjustment] Update down methods of duplicated migratio…
Browse files Browse the repository at this point in the history
…ns not to execute if the changes already exist in db (GSadee)

This PR was merged into the 1.0-dev branch.

Discussion
----------



Commits
-------

641d353 [Adjustment] Update down methods of duplicated migrations not to execute if the changes already exist in db
  • Loading branch information
lchrusciel authored Feb 17, 2021
2 parents 6d5338e + 641d353 commit 2a93f55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Migrations/Version20201130071338.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public function up(Schema $schema): void

public function down(Schema $schema): void
{
$adjustmentTable = $schema->getTable('sylius_adjustment');
if (!$adjustmentTable->hasColumn('shipment_id')) {
return;
}

$this->addSql('ALTER TABLE sylius_adjustment DROP FOREIGN KEY FK_ACA6E0F27BE036FC');
$this->addSql('DROP INDEX IDX_ACA6E0F27BE036FC ON sylius_adjustment');
$this->addSql('ALTER TABLE sylius_adjustment DROP shipment_id');
Expand Down
5 changes: 5 additions & 0 deletions src/Migrations/Version20201204071301.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public function up(Schema $schema): void

public function down(Schema $schema): void
{
$adjustmentTable = $schema->getTable('sylius_adjustment');
if (!$adjustmentTable->hasColumn('details')) {
return;
}

$this->addSql('ALTER TABLE sylius_adjustment DROP details');
}
}

0 comments on commit 2a93f55

Please sign in to comment.