Code Duplication    Length = 30-30 lines in 3 locations

console/migrations/m000000_000003_auth_rule.php 1 location

@@ 12-41 (lines=30) @@
9
 * @author Agiel K. Saputra <[email protected]>
10
 * @since 0.1.0
11
 */
12
class m000000_000003_auth_rule extends \yii\db\Migration
13
{
14
    /**
15
     * @inheritdoc
16
     */
17
    public function up()
18
    {
19
        $tableOptions = null;
20
21
        if ($this->db->driverName === 'mysql') {
22
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
23
        }
24
25
        $this->createTable('{{%auth_rule}}', [
26
            'name' => Schema::TYPE_STRING . '(64) NOT NULL',
27
            'data' => Schema::TYPE_TEXT,
28
            'created_at' => Schema::TYPE_INTEGER . '(11)',
29
            'updated_at' => Schema::TYPE_INTEGER . '(11)',
30
            'PRIMARY KEY ([[name]])',
31
        ], $tableOptions);
32
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37
    public function down()
38
    {
39
        $this->dropTable('{{%auth_rule}}');
40
    }
41
}
42

console/migrations/m000000_000013_post_meta.php 1 location

@@ 11-40 (lines=30) @@
8
 * @author Agiel K. Saputra <[email protected]>
9
 * @since 0.1.0
10
 */
11
class m000000_000013_post_meta 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('{{%post_meta}}', [
25
            'id' => Schema::TYPE_PK,
26
            'post_id' => Schema::TYPE_INTEGER . '(11) NOT NULL',
27
            'name' => Schema::TYPE_STRING . '(255) NOT NULL',
28
            'value' => Schema::TYPE_TEXT . ' NOT NULL',
29
            'FOREIGN KEY ([[post_id]]) REFERENCES {{%post}} ([[id]]) ON DELETE CASCADE ON UPDATE CASCADE',
30
        ], $tableOptions);
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function down()
37
    {
38
        $this->dropTable('{{%post_meta}}');
39
    }
40
}
41

console/migrations/m000000_000016_media_meta.php 1 location

@@ 11-40 (lines=30) @@
8
 * @author Agiel K. Saputra <[email protected]>
9
 * @since 0.1.0
10
 */
11
class m000000_000016_media_meta 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('{{%media_meta}}', [
25
            'id' => Schema::TYPE_PK,
26
            'media_id' => Schema::TYPE_INTEGER . '(11) NOT NULL',
27
            'name' => Schema::TYPE_STRING . '(255) NOT NULL',
28
            'value' => Schema::TYPE_TEXT . ' NOT NULL',
29
            'FOREIGN KEY ([[media_id]]) REFERENCES {{%media}} ([[id]]) ON DELETE CASCADE ON UPDATE CASCADE',
30
        ], $tableOptions);
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function down()
37
    {
38
        $this->dropTable('{{%media_meta}}');
39
    }
40
}
41