m170424_075136_add_language_translate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 11 1
A safeDown() 0 3 1
1
<?php
2
3
use yii\db\Migration;
4
5
class m170424_075136_add_language_translate extends Migration
6
{
7
    public $tableName = 'language_translation';
8
    public function safeUp()
9
    {
10
        $this->createTable($this->tableName,[
11
            'language_translation_id' => $this->primaryKey()->comment('ID'),
12
            'language_id' => $this->integer()->notNull()->comment('Language'),
13
            'model_class' => $this->string(255)->notNull()->comment('Translated model class name'),
14
            'model_field_name' => $this->string(128)->notNull()->comment('Translated model field Name'),
15
            'model_id' => $this->integer()->notNull()->comment('Translated model ID'),
16
            'value' => $this->text()->notNull()->comment('Translated model class name'),
17
        ]);
18
        $this->addForeignKey('fk_language_translation_language_id','language_translation','language_id','language','language_id');
19
20
    }
21
22
    public function safeDown()
23
    {
24
        $this->dropTable($this->tableName);
25
    }
26
}
27