f1f3595c
Yarik
test
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<?php
use yii\db\Migration;
class m160217_092739_currency_table extends Migration
{
public function up()
{
$this->createTable('{{%currency}}', [
'currency_id' => $this->primaryKey(),
'name' => $this->string(),
'symbol' => $this->string(),
'code' => $this->string(3),
'rate' => $this->float(4),
'date_update' => $this->timestamp()->defaultExpression('NOW()')
->notNull(),
'is_default' => $this->smallInteger(),
|
9cc08528
Yarik
test
|
19
|
'label' => $this->string(),
|
f1f3595c
Yarik
test
|
20
21
22
23
24
25
26
27
|
]);
$this->batchInsert('{{%currency}}', [
'currency_id',
'name',
'symbol',
'code',
'rate',
'is_default',
|
1b56164e
Yarik
test
|
28
|
'label',
|
f1f3595c
Yarik
test
|
29
30
31
32
33
34
35
36
|
], [
[
1,
'Доллар США',
'$',
'USD',
27.31,
0,
|
9cc08528
Yarik
test
|
37
|
'$',
|
f1f3595c
Yarik
test
|
38
39
40
41
42
43
44
|
],
[
2,
'Евро',
'€',
'EUR',
30.28,
|
9cc08528
Yarik
test
|
45
46
|
0,
'€',
|
f1f3595c
Yarik
test
|
47
48
49
50
51
52
53
54
|
],
[
3,
'Украинская гривна',
'₴',
'UAH',
1,
1,
|
9cc08528
Yarik
test
|
55
|
'грн.',
|
f1f3595c
Yarik
test
|
56
57
58
59
60
61
62
63
|
],
[
4,
'Российский рубль',
'₽',
'RUB',
0.34,
0,
|
9cc08528
Yarik
test
|
64
|
'руб.',
|
f1f3595c
Yarik
test
|
65
66
67
68
69
70
71
72
73
|
],
]);
}
public function down()
{
$this->dropTable('{{%currency}}');
}
}
|