Code Duplication    Length = 33-34 lines in 2 locations

console/migrations/m000000_000019_menu_item.php 1 location

@@ 11-44 (lines=34) @@
8
 * @author Agiel K. Saputra <[email protected]>
9
 * @since 0.1.0
10
 */
11
class m000000_000019_menu_item extends \yii\db\Migration
12
{
13
    /**
14
     * @inheritdoc
15
     */
16
    public function up()
17
    {
18
        $tableOptions = null;
19
20
        if ($this->db->driverName === 'mysql') {
21
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
22
        }
23
24
        $this->createTable('{{%menu_item}}', [
25
            'id' => Schema::TYPE_PK,
26
            'menu_id' => Schema::TYPE_INTEGER . '(11) NOT NULL',
27
            'label' => Schema::TYPE_STRING . '(255) NOT NULL',
28
            'url' => Schema::TYPE_TEXT . ' NOT NULL',
29
            'description' => Schema::TYPE_TEXT,
30
            'order' => Schema::TYPE_INTEGER . '(11) NOT NULL DEFAULT 0',
31
            'parent' => Schema::TYPE_INTEGER . '(11) NOT NULL DEFAULT 0',
32
            'options' => Schema::TYPE_TEXT,
33
            'FOREIGN KEY ([[menu_id]]) REFERENCES {{%menu}} ([[id]]) ON DELETE CASCADE ON UPDATE CASCADE',
34
        ], $tableOptions);
35
    }
36
37
    /**
38
     * @inheritdoc
39
     */
40
    public function down()
41
    {
42
        $this->dropTable('{{%menu_item}}');
43
    }
44
}
45

console/migrations/m000000_000021_widget.php 1 location

@@ 11-43 (lines=33) @@
8
 * @author Agiel K. Saputra <[email protected]>
9
 * @since 0.2.0
10
 */
11
class m000000_000021_widget extends \yii\db\Migration
12
{
13
    /**
14
     * @inheritdoc
15
     */
16
    public function up()
17
    {
18
        $tableOptions = null;
19
20
        if ($this->db->driverName === 'mysql') {
21
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
22
        }
23
24
        $this->createTable('{{%widget}}', [
25
            'id' => Schema::TYPE_PK,
26
            'title' => Schema::TYPE_STRING . '(255) NOT NULL',
27
            'config' => Schema::TYPE_TEXT . ' NOT NULL',
28
            'location' => Schema::TYPE_STRING . '(128) NOT NULL',
29
            'order' => Schema::TYPE_INTEGER . '(11) NOT NULL DEFAULT 0',
30
            'directory' => Schema::TYPE_STRING . '(128) NOT NULL',
31
            'date' => Schema::TYPE_DATETIME . ' NOT NULL',
32
            'modified' => Schema::TYPE_DATETIME . ' NOT NULL',
33
        ], $tableOptions);
34
    }
35
36
    /**
37
     * @inheritdoc
38
     */
39
    public function down()
40
    {
41
        $this->dropTable('{{%widget}}');
42
    }
43
}
44