执行迁移时发生错误
移民:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeSomeColumnsNullableToPacientesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('pacientes', function (Blueprint $table) {
$table->integer('obra_social_id')->unsigned()->nullable()->change();
$table->integer('plan_id')->unsigned()->nullable()->change();
$table->integer('pais_id')->unsigned()->nullable()->change();
$table->integer('provincia_id')->unsigned()->nullable()->change();
$table->integer('localidad_id')->unsigned()->nullable()->change();
$table->date('fechaNacimiento')->nullable()->change();
$table->string('telefono', 25)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pacientes', function (Blueprint $table) {
$table->integer('obra_social_id')->unsigned()->change();
$table->integer('plan_id')->unsigned()->change();
});
}
}
帮助请由于此错误,它使我无法很好地执行迁移
fechaNacimiento == 出生日期
原始表格:$ table-> date('fechaNacimiento');
尝试为您的列设置默认值:
$table->date('fechaNacimiento')->nullable()->default(NULL)->change();
或:
$table->date('fechaNacimiento')->nullable()->default('DEFAULT')->change();