laravel迁移更改列名
Schema::table('users', function (Blueprint $table) {
$table->renameColumn('from', 'to');
});
NU
Schema::table('users', function (Blueprint $table) {
$table->renameColumn('from', 'to');
});
laravel迁移整数
$table->bigInteger('votes');
laravel迁移的整数
$table->bigInteger('votes');
NU
php artisan migrate:rollback --step=1
laravel迁移更改列类型
public function up()
{
Schema::table('sometable', function (Blueprint $table) {
$table->text('text')->change();
});
}
迁移必填字段laravel
$table->string('foo')->nullable(false)->change();
laravel回滚上次迁移
php artisan migrate:rollback --step=1
laravel创建迁移
php artisan make:migration add_votes_to_users_table --table=users
php artisan make:migration create_users_table --create=users