frontend/modules/orderSpare/migrations/m160422_130101_order_spare.php
// Use safeUp/safeDown to run migration code within a transaction
Use safeUp/safeDown to run migration code within a transaction
Use safeUp / safeDown to run migration code within a transaction
public function safeUp()
    {
        $tableOptions = null;
        if ($this->db->driverName === 'mysql') {
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        }
        $this->createTable('{{%order_spare}}', [
            'id' => $this->primaryKey(),
            'callback_id' => $this->integer()->notNull(),
            'vin' => $this->integer()->notNull(),
            'catalog_number' => $this->integer()->notNull(),
            'comment' => $this->string()->notNull(),
            'car_model' => $this->string()->notNull(),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer()->notNull(),
        ], $tableOptions);
        $this->addForeignKey(
            'order_spare_fk',
            '{{%order_spare}}',
            'callback_id',
            '{{%callback}}',
            'id'
        );
    }
public function safeUp ( ) { $ tableOptions = null ; if ( $ this -> db -> driverName === 'mysql' ) { $ tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB' ; } $ this -> createTable ( '{{%order_spare}}' , [ 'id' => $ this -> primaryKey ( ) , 'callback_id' => $ this -> integer ( ) -> notNull ( ) , 'vin' => $ this -> integer ( ) -> notNull ( ) , 'catalog_number' => $ this -> integer ( ) -> notNull ( ) , 'comment' => $ this -> string ( ) -> notNull ( ) , 'car_model' => $ this -> string ( ) -> notNull ( ) , 'created_at' => $ this -> integer ( ) -> notNull ( ) , 'updated_at' => $ this -> integer ( ) -> notNull ( ) , ] , $ tableOptions ) ; $ this -> addForeignKey ( 'order_spare_fk' , '{{%order_spare}}' , 'callback_id' , '{{%callback}}' , 'id' ) ; }
Use safeUp/safeDown to run migration code within a transaction
Use safeUp / safeDown to run migration code within a transaction
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci