m180905_072743_customer_add_columns.php 2.01 KB
<?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');

    }

}