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

Version20250724115010::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 17
rs 10
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