如何在 Laravel 中使用 Migration?

How to use Migration in Laravel?

我目前 beginner of laravel。我正在从 official docs 学习 laravel 5.2。在学习了laravel中的migration之后,我很清楚它的迁移概念。但是在通过脚本代码练习时,我遇到了问题。问题是 laravel 告诉 laravel allows a team to easily modify and share the application's database schema。但是一旦通过table的迁移文件创建后如何change the structure of database table。我找到了解决方案 here。但是我对 8th step of the solution 有疑问,如果我将 运行 该命令,那么将执行所有迁移填充。所以这会给我 Table is already exists 的错误。我对么?如果是,请举例说明 link。我想我必须 运行 只迁移最后一个文件 2013_05_23_202930_update_users.php。如果这是答案,那么还要键入命令 运行 特定的单个迁移文件。如果有人知道答案,将不胜感激。

创建table:

if (!Schema::hasTable('users')) {
        Schema::create('users', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id')->unsigned();
            $table->string('username'); 
            $table->string('password', 60);                
            $table->timestamps();
            $table->softDeletes();
        });
    }

要向此 table 添加一些列:

php artisan make:migration add_somthing_to_users_table --table=users

Schema::table('users', function (Blueprint $table) {
        //
        if (!Schema::hasColumn('users', 'fb_id')) {
            //
            $table->string('fb_id')->default('');
        }
    });

伙计们,我找到了解决方案。在参考了this link后,我知道问题link中的解决方案是正确的。由于某种我不知道的原因,table 没有得到改变。但是在重新启动我的系统后,它起作用了。但是@rome的回答也是acceptable.