Passed
Push — master ( f88eb1...1417f0 )
by Angel Fernando Quiroz
22:09 queued 14:11
created

Version20251002110002::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
/* 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 Version20251002110002 extends AbstractMigrationChamilo
13
{
14
    public function getDescription(): string
15
    {
16
        return 'Remove unused foreign keys and columns from lti_external_tool table';
17
    }
18
19
    /**
20
     * @inheritDoc
21
     */
22
    public function up(Schema $schema): void
23
    {
24
        $externalTool = $schema->getTable('lti_external_tool');
25
26
        if ($externalTool->hasForeignKey('FK_DB0E04E491D79BD3')) {
27
            $this->addSql("ALTER TABLE lti_external_tool DROP FOREIGN KEY FK_DB0E04E491D79BD3");
28
        }
29
30
        if ($externalTool->hasForeignKey('FK_DB0E04E4727ACA70')) {
31
            $this->addSql("ALTER TABLE lti_external_tool DROP FOREIGN KEY FK_DB0E04E4727ACA70");
32
        }
33
34
        if ($externalTool->hasIndex('IDX_DB0E04E4727ACA70')) {
35
            $this->addSql("DROP INDEX IDX_DB0E04E4727ACA70 ON lti_external_tool");
36
        }
37
38
        if ($externalTool->hasIndex('IDX_DB0E04E491D79BD3')) {
39
            $this->addSql("DROP INDEX IDX_DB0E04E491D79BD3 ON lti_external_tool");
40
        }
41
42
        if ($externalTool->hasColumn('c_id')) {
43
            $this->addSql("ALTER TABLE lti_external_tool DROP COLUMN c_id");
44
        }
45
46
        if ($externalTool->hasColumn('parent_id')) {
47
            $this->addSql("ALTER TABLE lti_external_tool DROP COLUMN parent_id");
48
        }
49
    }
50
}