Version20200208064342   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 13
dl 0
loc 17
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A up() 0 15 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Migration;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
10
class Version20200208064342 extends AbstractMigration
11
{
12
    public function up(Schema $schema): void
13
    {
14
        $this->addSql('DROP INDEX institution_longitude_idx ON institution');
15
        $this->addSql('DROP INDEX institution_latitude_idx ON institution');
16
        $this->addSql('ALTER TABLE institution ADD location POINT DEFAULT NULL COMMENT \'(DC2Type:point)\'');
17
        $this->addSql('UPDATE institution SET longitude = NULL, latitude = NULL WHERE longitude = 0 OR latitude = 0');
18
        $this->addSql('UPDATE institution SET location = ST_PointFromText(CONCAT(\'POINT(\', longitude ,\' \', latitude,\')\')) WHERE longitude IS NOT NULL AND latitude IS NOT NULL');
19
        $this->addSql('ALTER TABLE institution DROP latitude, DROP longitude');
20
21
        $this->addSql('DROP INDEX card_latitude_idx ON card');
22
        $this->addSql('DROP INDEX card_longitude_idx ON card');
23
        $this->addSql('ALTER TABLE card ADD location POINT DEFAULT NULL COMMENT \'(DC2Type:point)\'');
24
        $this->addSql('UPDATE card SET longitude = NULL, latitude = NULL WHERE longitude = 0 OR latitude = 0');
25
        $this->addSql('UPDATE card SET location = ST_PointFromText(CONCAT(\'POINT(\', longitude ,\' \', latitude,\')\')) WHERE longitude IS NOT NULL AND latitude IS NOT NULL');
26
        $this->addSql('ALTER TABLE card DROP latitude, DROP longitude');
27
    }
28
}
29