|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use yii\db\Migration; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Handles the creation for table `{{%confirmation_request}}`. |
|
7
|
|
|
*/ |
|
8
|
|
|
class m170314_062153_create_table_confirmation_request extends Migration |
|
|
|
|
|
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* @inheritdoc |
|
12
|
|
|
*/ |
|
13
|
|
|
public function safeUp() |
|
14
|
|
|
{ |
|
15
|
|
|
$this->createTable('{{%confirmation_request}}', [ |
|
16
|
|
|
|
|
17
|
|
|
'id' => $this->primaryKey()->unsigned()->notNull(), |
|
18
|
|
|
'model' => $this->string(255), |
|
19
|
|
|
'object_id' => $this->integer(11)->unsigned(), |
|
20
|
|
|
'object' => $this->text(), |
|
21
|
|
|
'release_token' => $this->string(255), |
|
22
|
|
|
'created_at' => $this->integer(11), |
|
23
|
|
|
'updated_at' => $this->integer(11), |
|
24
|
|
|
'values' => $this->text(), |
|
25
|
|
|
'created_by' => $this->integer(11)->unsigned(), |
|
26
|
|
|
'updated_by' => $this->integer(11)->unsigned(), |
|
27
|
|
|
|
|
28
|
|
|
]); |
|
29
|
|
|
|
|
30
|
|
|
// creates index for column `created_by` |
|
31
|
|
|
$this->createIndex( |
|
32
|
|
|
'confirmation_request_ibfk_2', |
|
33
|
|
|
'{{%confirmation_request}}', |
|
34
|
|
|
'created_by' |
|
35
|
|
|
); |
|
36
|
|
|
|
|
37
|
|
|
// add foreign key for table `user` |
|
38
|
|
|
$this->addForeignKey( |
|
39
|
|
|
'confirmation_request_ibfk_2', |
|
40
|
|
|
'{{%confirmation_request}}', |
|
41
|
|
|
'created_by', |
|
42
|
|
|
'{{%user}}', |
|
43
|
|
|
'id', |
|
44
|
|
|
'CASCADE' |
|
45
|
|
|
); |
|
46
|
|
|
|
|
47
|
|
|
// creates index for column `updated_by` |
|
48
|
|
|
$this->createIndex( |
|
49
|
|
|
'confirmation_request_ibfk_3', |
|
50
|
|
|
'{{%confirmation_request}}', |
|
51
|
|
|
'updated_by' |
|
52
|
|
|
); |
|
53
|
|
|
|
|
54
|
|
|
// add foreign key for table `user` |
|
55
|
|
|
$this->addForeignKey( |
|
56
|
|
|
'confirmation_request_ibfk_3', |
|
57
|
|
|
'{{%confirmation_request}}', |
|
58
|
|
|
'updated_by', |
|
59
|
|
|
'{{%user}}', |
|
60
|
|
|
'id', |
|
61
|
|
|
'CASCADE' |
|
62
|
|
|
); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @inheritdoc |
|
67
|
|
|
*/ |
|
68
|
|
|
public function safeDown() |
|
69
|
|
|
{ |
|
70
|
|
|
// drops foreign key for table `user` |
|
71
|
|
|
$this->dropForeignKey( |
|
72
|
|
|
'confirmation_request_ibfk_2', |
|
73
|
|
|
'{{%confirmation_request}}' |
|
74
|
|
|
); |
|
75
|
|
|
|
|
76
|
|
|
// drops index for column `created_by` |
|
77
|
|
|
$this->dropIndex( |
|
78
|
|
|
'confirmation_request_ibfk_2', |
|
79
|
|
|
'{{%confirmation_request}}' |
|
80
|
|
|
); |
|
81
|
|
|
|
|
82
|
|
|
// drops foreign key for table `user` |
|
83
|
|
|
$this->dropForeignKey( |
|
84
|
|
|
'confirmation_request_ibfk_3', |
|
85
|
|
|
'{{%confirmation_request}}' |
|
86
|
|
|
); |
|
87
|
|
|
|
|
88
|
|
|
// drops index for column `updated_by` |
|
89
|
|
|
$this->dropIndex( |
|
90
|
|
|
'confirmation_request_ibfk_3', |
|
91
|
|
|
'{{%confirmation_request}}' |
|
92
|
|
|
); |
|
93
|
|
|
|
|
94
|
|
|
$this->dropTable('{{%confirmation_request}}'); |
|
95
|
|
|
} |
|
96
|
|
|
} |
|
97
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.