$mysql--x86_64上用于OSX10.14的mysql版本8.0.19(自制)
我做了迁移文件。
$ php artisan make:migration add_request_to_users_table --table=users
Created Migration: 2020_07_05_231205_add_request_to_users_table
我这样修改了文件迁移
class AddRequestToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('request');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
//
});
}
}
$ php artisan migrate
Migrating: 2020_07_05_231205_add_request_to_users_table
Migrated: 2020_07_05_231205_add_request_to_users_table (0.01 seconds)
但“Request”列未添加到用户表中。 怎么会?
你的代码没有错。 如果使用以下导入:
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
应该管用。 再次尝试刷新并检查数据库或db架构。