m180905_072743_customer_add_columns.php
2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
use yii\db\Migration;
/**
 * Class m180905_072743_customer_add_columns
 */
class m180905_072743_customer_add_columns extends Migration
{
	/*
* New properties
* 1 phone ==> office
* 2 phone ==> other
* 3 fax
* 4 phone ==> own
* 5 passport
*          1) number
*          2) date
*          3) place
*          4) valid until
* 6 need visa
* 7 special meal
*          1) halal
*          2) kashrut
*          3) vegetarian
* 8 working language
*          1) rus
*          2) eng
*          3) french
	 * */
    public function up()
    {
		$this->addColumn('customer','phone_own',$this->string(30));
		$this->addColumn('customer','phone_office',$this->string(30));
		$this->addColumn('customer','phone_other',$this->string(30));
		$this->addColumn('customer','fax',$this->string(30));
		$this->addColumn('customer','passport_number',$this->integer());
		$this->addColumn('customer','passport_date',$this->integer());
		$this->addColumn('customer','passport_place',$this->string(200));
		$this->addColumn('customer','passport_valid',$this->integer());
		$this->addColumn('customer','need_visa',$this->boolean());
		#$this->addColumn('customer','working_language',$this->tinyInteger());
		$this->addColumn('customer','special_meal',$this->string(255)->defaultValue('none'));
		$this->addCommentOnColumn('customer','passport_date','когда выдан');
		$this->addCommentOnColumn('customer','passport_place','кем выдан');
		$this->addCommentOnColumn('customer','passport_valid','действителен до');
    }
    public function down()
    {
		$this->dropColumn('customer','phone_own');
		$this->dropColumn('customer','phone_office');
		$this->dropColumn('customer','phone_other');
		$this->dropColumn('customer','fax');
		$this->dropColumn('customer','passport_number');
		$this->dropColumn('customer','passport_date');
		$this->dropColumn('customer','passport_place');
		$this->dropColumn('customer','passport_valid');
		$this->dropColumn('customer','need_visa');
		$this->dropColumn('customer','special_meal');
    }
}