m171219_144450_createStructure   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
eloc 18
dl 0
loc 26
rs 10
c 1
b 0
f 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A initInverter() 0 23 1
1
<?php
2
use execut\yii\migration\Migration;
3
4
/**
5
 * Class m171219_144450_createStructure
6
 */
7
class m171219_144450_createStructure extends Migration
8
{
9
    // Use up()/down() to run migration code without a transaction.
10
    public function initInverter(\execut\yii\migration\Inverter $i)
11
    {
12
        $i->table('example_brands')
13
            ->create($this->defaultColumns([
14
                'name' => $this->string()->notNull(),
15
            ]));
16
        $i->table('example_articles')
17
            ->create($this->defaultColumns([
18
                'article' => $this->string()->notNull(),
19
                'source' => $this->string(),
20
            ]))
21
            ->addForeignColumn('example_brands', true);
22
        $i->table('example_brands_aliases')
23
            ->create($this->defaultColumns([
24
                'name' => $this->string()->notNull(),
25
            ]))
26
            ->addForeignColumn('example_brands', true);
27
        $i->table('example_products')
28
            ->create($this->defaultColumns([
29
                'name' => $this->string()->notNull(),
30
                'price' => $this->float(2),
31
            ]))
32
            ->addForeignColumn('example_articles');
33
    }
34
}
35