Passed
Push — skills ( e6c35a )
by Angel Fernando Quiroz
12:27 queued 14s
created

Version20241209103000   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 15
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 3 1
A up() 0 8 1
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
8
9
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
10
use Doctrine\DBAL\Schema\Schema;
11
12
class Version20241209103000 extends AbstractMigrationChamilo
13
{
14
    public function getDescription(): string
15
    {
16
        return 'Change extra field boolean columns (visible_to_self, visible_to_others, changeable, filter) to not accept null values.';
17
    }
18
19
    public function up(Schema $schema): void
20
    {
21
        $this->addSql('UPDATE extra_field SET visible_to_self = 0 WHERE visible_to_self IS NULL');
22
        $this->addSql('UPDATE extra_field SET visible_to_others = 0 WHERE visible_to_others IS NULL');
23
        $this->addSql('UPDATE extra_field SET changeable = 0 WHERE changeable IS NULL');
24
        $this->addSql('UPDATE extra_field SET filter = 0 WHERE filter IS NULL');
25
26
        $this->addSql('ALTER TABLE extra_field CHANGE visible_to_self visible_to_self TINYINT(1) DEFAULT 0 NOT NULL, CHANGE visible_to_others visible_to_others TINYINT(1) DEFAULT 0 NOT NULL, CHANGE changeable changeable TINYINT(1) DEFAULT 0 NOT NULL, CHANGE filter filter TINYINT(1) DEFAULT 0 NOT NULL');
27
    }
28
}
29