m171219_144450_createStructure::initInverter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 17
dl 0
loc 23
rs 9.7
c 1
b 0
f 1
cc 1
nc 1
nop 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