Yii 2 Create Migration With Fields

[Solved] Yii 2 Create Migration With Fields | Php Frameworks Yii - Code Explorer | yomemimo.com
Question : yii2 migration add column

Answered by : cloudy-cobra-8q6lznkx3fln

class m150811_220037_add_position_column_to_post_table extends Migration
{ public function up() { $this->addColumn('post', 'position', $this->integer()); } public function down() { $this->dropColumn('post', 'position'); }
}

Source : https://www.yiiframework.com/doc/guide/2.0/en/db-migrations#add-column | Last Update : Sun, 09 Aug 20

Question : yii2 migration --fields foreign

Answered by : purple-team

yii migrate/create create_post_table --fields="author_id:integer:notNull:foreignKey(user),category_id:integer:defaultValue(1):foreignKey,title:string,body:text"

Source : https://www.yiiframework.com/doc/guide/2.0/en/db-migrations | Last Update : Sat, 23 Apr 22

Question : yii 2 create migration with fields

Answered by : mike-keller

yii migrate/create create_post_table --fields="title:string(12):notNull:unique,body:text"

Source : https://www.yiiframework.com/doc/guide/2.0/en/db-migrations | Last Update : Fri, 11 Feb 22

Answers related to yii 2 create migration with fields

Code Explorer Popular Question For Php Frameworks Yii