m161031_103929_create_template_background_table   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 12 2
A down() 0 4 1
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Handles the creation of table `template_background`.
7
 */
8
// @codingStandardsIgnoreLine
9
class m161031_103929_create_template_background_table extends Migration
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function up()
15
    {
16
        $tableOptions = null;
17
        if ($this->db->driverName === 'mysql') {
18
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
19
        }
20
21
        $this->createTable('template_background', [
22
            'id' => $this->primaryKey()->notNull()->append('AUTO_INCREMENT'),
23
            'webpath' => $this->string(256)->notNull(),
24
        ], $tableOptions);
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function down()
31
    {
32
        $this->dropTable('template_background');
33
    }
34
}
35