Skip to content

Commit

Permalink
Merge pull request #403 from dis-moi/fix/migrationsLocale
Browse files Browse the repository at this point in the history
fix(migration): locale fr
  • Loading branch information
gregoirelacoste authored Jun 29, 2021
2 parents 64e277a + 313e0c3 commit c252437
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions migrations/Version20210519132610.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ final class Version20210519132610 extends AbstractMigration
{
public function up(Schema $schema): void
{
$localDefault = \Locale::getDefault();

$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE contributor ADD locale VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE notice ADD locale VARCHAR(255) DEFAULT NULL');
$this->addSql("UPDATE contributor SET locale = '{$localDefault}' WHERE locale is NULL");
$this->addSql("UPDATE contributor SET locale = 'fr' WHERE locale is NULL");
}

public function down(Schema $schema): void
Expand Down

0 comments on commit c252437

Please sign in to comment.