Сначала я создал такую миграцию:
Schema::create('table1',function(Blueprint $table){
$table->bigIncrements('id');
$table->string('name')->unique();
$table->integer("user_id")->unsigned();
$table->foreign("user_id)->references("id")->on("users");
});
Затем я хотел добавить свойство, допускающее значение NULL, в столбец user_id, я написал эту миграцию:
Schema::table('f_subjects', function (Blueprint $table) {
$table->integer('user_id')->nullable()->change();
$table->foreign('original_law_id')->references('id')->on('f_original_law');
});
Но у меня возникла такая ошибка:
Cannot change column 'user_id': used in a foreign key constraint 'table1_user_id_foreign'
Подробнее здесь: https://stackoverflow.com/questions/481 ... -migration