我做的laravel登记表,首先我创建迁移如何使默认值空在laravel
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('first_name');
$table->string('last_name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}
我想先不FIRST_NAME和姓氏登记姓名,电子邮件地址和密码,但我当点击注册它给我错误,first_name和last_name没有默认值..所以如何使默认值为空,因为我想稍后更新该列。
您是否回滚并再次运行迁移,或者是否是新的迁移以更改值?你也有哪些SQL版本? – jycr753