1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use yii\db\Migration; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Handles the creation of table `{{%account}}`. |
7
|
|
|
*/ |
8
|
|
|
class m200730_062450_create_account_table extends Migration |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* {@inheritdoc} |
12
|
|
|
*/ |
13
|
|
|
public function safeUp() |
14
|
|
|
{ |
15
|
|
|
$this->createTable('{{%account}}', [ |
16
|
|
|
'id' => $this->primaryKey(), |
17
|
|
|
'user_id' => $this->integer()->notNull(), |
18
|
|
|
'name' => $this->string(120)->notNull(), |
19
|
|
|
'type' => $this->tinyInteger()->notNull(), |
20
|
|
|
'color' => $this->string(7)->notNull(), |
21
|
|
|
'balance_cent' => $this->bigInteger()->defaultValue(0), |
22
|
|
|
'currency_code' => $this->string(3)->notNull(), |
23
|
|
|
'status' => $this->tinyInteger()->defaultValue(1), |
24
|
|
|
'exclude_from_stats' => $this->tinyInteger()->defaultValue(0), |
25
|
|
|
'credit_card_limit' => $this->integer(), |
26
|
|
|
'credit_card_repayment_day' => $this->tinyInteger(), |
27
|
|
|
'credit_card_billing_day' => $this->tinyInteger(), |
28
|
|
|
'created_at' => $this->timestamp()->defaultValue(null), |
29
|
|
|
'updated_at' => $this->timestamp()->defaultValue(null), |
30
|
|
|
]); |
31
|
|
|
|
32
|
|
|
$this->createIndex('account_user_id', '{{%account}}', 'user_id'); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* {@inheritdoc} |
37
|
|
|
*/ |
38
|
|
|
public function safeDown() |
39
|
|
|
{ |
40
|
|
|
$this->dropTable('{{%account}}'); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
} |
44
|
|
|
|