Passed
Push — translations ( 6cd971...bddd68 )
by Yannick
35:39 queued 27:44
created

Version20230904173401::up()   C

Complexity

Conditions 9
Paths 256

Size

Total Lines 36
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
cc 9
eloc 19
c 4
b 0
f 0
nc 256
nop 1
dl 0
loc 36
rs 6.5222
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 Version20230904173401 extends AbstractMigrationChamilo
13
{
14
    public function getDescription(): string
15
    {
16
        return 'Calendar: Cleanup about invitations/subscriptions';
17
    }
18
19
    public function up(Schema $schema): void
20
    {
21
        $table = $schema->getTable('personal_agenda');
22
23
        if ($table->hasForeignKey('FK_D8612460AF68C6B')) {
24
            $this->addSql('ALTER TABLE personal_agenda DROP FOREIGN KEY FK_D8612460AF68C6B');
25
        }
26
27
        if ($table->hasIndex('UNIQ_D8612460AF68C6B')) {
28
            $this->addSql('DROP INDEX UNIQ_D8612460AF68C6B ON personal_agenda');
29
        }
30
31
        if ($table->hasColumn('agenda_event_invitation_id')) {
32
            $this->addSql('ALTER TABLE personal_agenda DROP agenda_event_invitation_id');
33
        }
34
35
        if ($table->hasColumn('collective')) {
36
            $this->addSql('ALTER TABLE personal_agenda DROP collective');
37
        }
38
39
        if ($table->hasColumn('subscription_visibility')) {
40
            $this->addSql('ALTER TABLE personal_agenda DROP subscription_visibility');
41
        }
42
43
        if ($table->hasColumn('subscription_item_id')) {
44
            $this->addSql('ALTER TABLE personal_agenda DROP subscription_item_id');
45
        }
46
47
        if ($schema->hasTable('agenda_event_invitee')) {
48
            $this->addSql('ALTER TABLE agenda_event_invitee DROP FOREIGN KEY FK_4F5757FEA76ED395');
49
            $this->addSql('DROP TABLE agenda_event_invitee');
50
        }
51
52
        if ($schema->hasTable('agenda_event_invitation')) {
53
            $this->addSql('ALTER TABLE agenda_event_invitation DROP FOREIGN KEY FK_52A2D5E161220EA6');
54
            $this->addSql('DROP TABLE agenda_event_invitation');
55
        }
56
    }
57
}
58