Passed
Pull Request — master (#5665)
by
unknown
07:18
created

Version20240715183456::getDescription()   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 0
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\Entity\ExtraField;
10
use Doctrine\DBAL\Schema\Schema;
11
use Doctrine\Migrations\AbstractMigration;
12
13
final class Version20240715183456 extends AbstractMigration
14
{
15
    public function getDescription(): string
16
    {
17
        return 'Remove the special_course field from the extra_field table and related entries in extra_field_values';
18
    }
19
20
    public function up(Schema $schema): void
21
    {
22
        $extraFieldType = ExtraField::COURSE_FIELD_TYPE;
23
24
        // Delete entries in extra_field_values
25
        $this->addSql("DELETE FROM extra_field_values WHERE field_id IN (
26
            SELECT id FROM extra_field
27
            WHERE item_type = $extraFieldType AND variable = 'special_course'
28
        )");
29
30
        // Delete the extra_field
31
        $this->addSql("DELETE FROM extra_field WHERE variable = 'special_course' AND item_type = $extraFieldType");
32
    }
33
34
    public function down(Schema $schema): void
35
    {
36
    }
37
}
38