Table 'users':
|id|name|address|post_code|deleted_at|created_at|
and I want add column 'phone_nr' somewhere between 'id' and 'deleted_at'
Is it possible by migrations in Laravel 4.1?
Table 'users':
|id|name|address|post_code|deleted_at|created_at|
and I want add column 'phone_nr' somewhere between 'id' and 'deleted_at'
Is it possible by migrations in Laravel 4.1?
对使用php artisan migrate:make update_users_table
创建新的migrations.
Then use the table
command as follows (if you're using MySQL!):
Schema::table('users', function($table)
{
$table->string('phone_nr')->after('id');
});
完成迁移后,保存并使用php artisan migrate
运行它,表将被更新.
文件:https://laravel.com/docs/4.2/migrations#column-modifiers份