m150522_000001_create_audit_javscript   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 14 2
A down() 0 4 1
1
<?php
2
3
use yii\db\Schema;
4
5
class m150522_000001_create_audit_javscript extends \yii\db\Migration
6
{
7
    const TABLE = '{{%audit_javascript}}';
8
9
    public function up()
10
    {
11
        $this->createTable(self::TABLE, [
12
            'id'         => Schema::TYPE_PK,
13
            'audit_id'   => Schema::TYPE_INTEGER . ' NOT NULL',
14
            'created'    => Schema::TYPE_DATETIME . ' NOT NULL',
15
            'type'       => Schema::TYPE_STRING . '(20) NOT NULL',
16
            'message'    => Schema::TYPE_TEXT . ' NOT NULL',
17
            'origin'     => Schema::TYPE_STRING . '(512)',
18
            'data'       => 'BLOB NULL',
19
        ], $this->db->driverName === 'mysql' ? 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB' : null);
20
21
        $this->addForeignKey('fk_audit_javascript_audit_id', self::TABLE, ['audit_id'], '{{%audit_entry}}', 'id', 'CASCADE');
22
    }
23
24
    public function down()
25
    {
26
        $this->dropTable(self::TABLE);
27
    }
28
}
29