Skip to content

Commit

Permalink
[Migrations] Add missing mysql check for migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
GSadee committed Feb 23, 2022
1 parent b9c36f7 commit 314cd10
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ public function getDescription(): string

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 sylius_order ADD by_guest TINYINT(1) DEFAULT \'1\' NOT NULL');
$this->addSql('UPDATE sylius_order o SET o.by_guest = 0 WHERE o.customer_id IN (SELECT customer_id FROM sylius_shop_user)');
}

public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE sylius_order DROP by_guest');
}
}

0 comments on commit 314cd10

Please sign in to comment.