Completed
Push — 1.10.x ( 2635b5...f0080b )
by Yannick
165:55 queued 120:08
created

Version20151101082200   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 30
loc 30
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Application\Migrations\Schema\V110;
5
6
use Application\Migrations\AbstractMigrationChamilo;
7
use Doctrine\DBAL\Schema\Schema;
8
9
/**
10
 * Calendar color
11
 */
12
class Version20151101082200 extends AbstractMigrationChamilo
13
{
14
    /**
15
     * @param Schema $schema
16
     */
17
    public function up(Schema $schema)
18
    {
19
        $this->addSql("ALTER TABLE access_url ENGINE=InnoDB");
20
        $this->addSql("ALTER TABLE access_url_rel_course ENGINE=InnoDB");
21
        $this->addSql("ALTER TABLE course_rel_user ENGINE=InnoDB");
22
        $this->addSql("ALTER TABLE session_category ENGINE=InnoDB");
23
        $this->addSql("ALTER TABLE settings_current ENGINE=InnoDB");
24
        $this->addSql("ALTER TABLE settings_options ENGINE=InnoDB");
25
        $this->addSql("ALTER TABLE usergroup ENGINE=InnoDB");
26
        $this->addSql("ALTER TABLE usergroup_rel_user ENGINE=InnoDB");
27
28
        $this->addSql("ALTER TABLE session_rel_course DROP PRIMARY KEY");
29
        $this->addSql("ALTER TABLE session_rel_course_rel_user DROP PRIMARY KEY");
30
        $this->addSql("ALTER TABLE session MODIFY session_category_id INT NULL");
31
32
        $this->addSql("UPDATE session SET session_category_id = NULL WHERE session_category_id = 0");
33
    }
34
35
    /**
36
     * @param Schema $schema
37
     */
38
    public function down(Schema $schema)
39
    {
40
    }
41
}
42