Passed
Push — master ( 6304f4...fc13ff )
by Julito
08:01
created

Version20191206150000::up()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 9
c 0
b 0
f 0
nc 8
nop 1
dl 0
loc 14
rs 9.9666
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
6
7
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
8
use Doctrine\DBAL\Schema\Schema;
9
10
/**
11
 * Extra fields.
12
 */
13
class Version20191206150000 extends AbstractMigrationChamilo
14
{
15
    public function up(Schema $schema): void
16
    {
17
        $table = $schema->getTable('extra_field');
18
        if (false === $table->hasColumn('helper_text')) {
19
            $this->addSql('ALTER TABLE extra_field ADD helper_text text DEFAULT NULL AFTER display_text');
20
        }
21
        $this->addSql('ALTER TABLE extra_field_values CHANGE value value LONGTEXT DEFAULT NULL;');
22
        if (false === $table->hasColumn('description')) {
23
            $this->addSql('ALTER TABLE extra_field ADD description LONGTEXT DEFAULT NULL');
24
        }
25
26
        $table = $schema->getTable('extra_field_values');
27
        if (!$table->hasIndex('idx_efv_item')) {
28
            $this->addSql('CREATE INDEX idx_efv_item ON extra_field_values (item_id)');
29
        }
30
    }
31
}
32