m170101_000003_workflow_transition::columns()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
use roaresearch\yii2\rmdb\migrations\CreateEntity;
4
5
class m170101_000003_workflow_transition extends CreateEntity
6
{
7
    /**
8
     * @inhertidoc
9
     */
10
    public function getTableName(): string
11
    {
12
        return 'workflow_transition';
13
    }
14
15
    /**
16
     * @inhertidoc
17
     */
18
    public function columns(): array
19
    {
20
        return [
21
            'source_stage_id' => $this->normalKey(),
22
            'target_stage_id' => $this->normalKey(),
23
            'name' => $this->string(64)->notNull(),
24
        ];
25
    }
26
27
    /**
28
     * @inhertidoc
29
     */
30
    public function foreignKeys(): array
31
    {
32
        return [
33
            'source_stage_id' => 'workflow_stage',
34
            'target_stage_id' => 'workflow_stage',
35
        ];
36
    }
37
38
    /**
39
     * @inhertidoc
40
     */
41
    public function compositePrimaryKeys(): array
42
    {
43
        return ['source_stage_id', 'target_stage_id'];
44
    }
45
46
    /**
47
     * @inhertidoc
48
     */
49
    public function compositeUniqueKeys(): array
50
    {
51
        return [['source_stage_id', 'name']];
52
    }
53
}
54