Issues (3627)

app/migrations/Version20200815153711.php (1 issue)

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * @copyright   <year> Mautic Contributors. All rights reserved.
7
 * @author      Mautic
8
 * @link        https://mautic.org
9
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
 */
11
12
namespace Mautic\Migrations;
13
14
use Doctrine\DBAL\Schema\Schema;
15
use Doctrine\Migrations\Exception\SkipMigration;
16
use Mautic\CoreBundle\Doctrine\AbstractMauticMigration;
17
18
final class Version20200815153711 extends AbstractMauticMigration
19
{
20
    /**
21
     * @throws SkipMigrationException
22
     */
23
    public function preUp(Schema $schema): void
24
    {
25
        $shouldRunMigration = true;
26
27
        if (!$shouldRunMigration) {
0 ignored issues
show
The condition $shouldRunMigration is always true.
Loading history...
28
            throw new SkipMigration('Schema includes this migration');
29
        }
30
    }
31
32
    public function up(Schema $schema): void
33
    {
34
        $oldAndNewValues = [
35
            'Braganca'                   => 'Bragança',
36
            'Colmbra'                    => 'Coimbra',
37
            'Ovora'                      => 'Évora',
38
            'Santarem'                   => 'Santarém',
39
            'Setubal'                    => 'Setúbal',
40
            'Regiao Autonoma dos Acores' => 'Região Autónoma dos Açores',
41
            'Regiao Autonoma da Madeira' => 'Região Autónoma da Madeira',
42
        ];
43
44
        foreach ($oldAndNewValues as $old => $new) {
45
            $this->addSql("UPDATE `{$this->prefix}leads` SET `state` = '{$new}' WHERE `state` = '{$old}'");
46
        }
47
    }
48
}
49