|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use yii\db\Migration; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Handles the creation of table `{{%rule}}`. |
|
7
|
|
|
*/ |
|
8
|
|
|
class m200814_032606_create_rule_table extends Migration |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* {@inheritdoc} |
|
12
|
|
|
*/ |
|
13
|
|
|
public function safeUp() |
|
14
|
|
|
{ |
|
15
|
|
|
$this->createTable('{{%rule}}', [ |
|
16
|
|
|
'id' => $this->primaryKey(), |
|
17
|
|
|
'user_id' => $this->integer()->notNull(), |
|
18
|
|
|
'name' => $this->string()->notNull(), |
|
19
|
|
|
'if_keywords' => $this->string()->notNull()->comment('Multiple choice use,'), |
|
20
|
|
|
'if_direction' => $this->tinyInteger()->defaultValue(0)->comment('0:any'), |
|
21
|
|
|
'then_direction' => $this->tinyInteger(), |
|
22
|
|
|
'then_category_id' => $this->integer(), |
|
23
|
|
|
'then_account_id' => $this->integer(), |
|
24
|
|
|
'then_transaction_status' => $this->tinyInteger(), |
|
25
|
|
|
'then_reimbursement_status' => $this->tinyInteger(), |
|
26
|
|
|
'then_tags' => $this->string()->comment('Multiple choice use,'), |
|
27
|
|
|
'status' => $this->tinyInteger()->defaultValue(1), |
|
28
|
|
|
'created_at' => $this->timestamp()->defaultValue(null), |
|
29
|
|
|
'updated_at' => $this->timestamp()->defaultValue(null), |
|
30
|
|
|
]); |
|
31
|
|
|
|
|
32
|
|
|
$this->createIndex('rule_user_id', '{{%rule}}', 'user_id'); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* {@inheritdoc} |
|
37
|
|
|
*/ |
|
38
|
|
|
public function safeDown() |
|
39
|
|
|
{ |
|
40
|
|
|
$this->dropTable('{{%rule}}'); |
|
41
|
|
|
} |
|
42
|
|
|
} |
|
43
|
|
|
|