Passed
Pull Request — master (#6515)
by
unknown
17:45 queued 08:12
created

Version20250724115010   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 17 1
A getDescription() 0 3 1
A down() 0 1 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\Entity\ExtraField;
10
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
11
use Doctrine\DBAL\Schema\Schema;
12
13
final class Version20250724115010 extends AbstractMigrationChamilo
14
{
15
    public function getDescription(): string
16
    {
17
        return 'Remove show_conditions_to_user setting and gdpr + my_terms extra_fields';
18
    }
19
20
    public function up(Schema $schema): void
21
    {
22
        $this->addSql("DELETE FROM settings WHERE variable = 'show_conditions_to_user'");
23
24
        $userType = ExtraField::USER_FIELD_TYPE;
25
        $this->addSql("
26
            DELETE FROM extra_field_values
27
            WHERE field_id IN (
28
                SELECT id FROM extra_field
29
                WHERE item_type = $userType
30
                  AND variable IN ('gdpr','my_terms')
31
            )
32
        ");
33
34
        $this->addSql("
35
            DELETE FROM extra_field
36
            WHERE item_type = $userType
37
              AND variable IN ('gdpr','my_terms')
38
        ");
39
    }
40
41
    public function down(Schema $schema): void {}
42
}
43