m160714_124817_create_car.php 827 Bytes
<?php
    
    use yii\db\Migration;
    
    class m160714_124817_create_car extends Migration
    {
        
        public function up()
        {
            $this->createTable('car', [
                'car_id'  => $this->primaryKey(),
                'model'   => $this->string()
                                  ->notNull(),
                'year'    => $this->integer()
                                  ->notNull(),
                'image'   => $this->string(),
                'color'   => $this->string(),
                'mileage' => $this->float(),
                'build'   => $this->integer(),
                'option'  => $this->text(),
                'price'   => $this->float(),
            ]);
        }
        
        public function down()
        {
            $this->dropTable('car');
        }
    }