Passed
Push — master ( bc6275...9d4f8a )
by
unknown
15:50 queued 08:07
created

Version20250305123000::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
8
9
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
10
use Doctrine\DBAL\Schema\Schema;
11
12
final class Version20250305123000 extends AbstractMigrationChamilo
13
{
14
    public function getDescription(): string
15
    {
16
        return 'Sets visible_to_self and changeable to 0 for extra fields migrated from configuration.php.';
17
    }
18
19
    public function up(Schema $schema): void
20
    {
21
        $this->addSql("
22
            UPDATE extra_field
23
            SET visible_to_self = 0, changeable = 0
24
            WHERE variable IN (
25
                'session_courses_read_only_mode',
26
                'is_mandatory',
27
                'show_in_catalogue',
28
                'multiple_language',
29
                'send_notification_at_a_specific_date',
30
                'date_to_send_notification',
31
                'send_to_users_in_session',
32
                'tags',
33
                'acquisition',
34
                'invisible',
35
                'start_date',
36
                'end_date'
37
            );
38
        ");
39
    }
40
41
    public function down(Schema $schema): void
42
    {
43
        $this->addSql("
44
            UPDATE extra_field
45
            SET visible_to_self = 1, changeable = 1
46
            WHERE variable IN (
47
                'session_courses_read_only_mode',
48
                'is_mandatory',
49
                'show_in_catalogue',
50
                'multiple_language',
51
                'send_notification_at_a_specific_date',
52
                'date_to_send_notification',
53
                'send_to_users_in_session',
54
                'tags',
55
                'acquisition',
56
                'invisible',
57
                'start_date',
58
                'end_date'
59
            );
60
        ");
61
    }
62
}
63