Laravel Schema onDelete设置为null
无法弄清楚如何在Laravel中的表上设置适当的onDelete约束。(我正在使用SqLite) $table->...->onDelete('cascade'); // works $table->...->onDelete('null || set null'); // neither of them work 我进行了3次迁移,创建了Gallery表: Schema::create('galleries', function($table) { $table->increments('id'); $table->string('name')->unique(); $table->text('path')->unique(); $table->text('description')->nullable(); $table->timestamps(); $table->engine = 'InnoDB'; }); 创建图片表: Schema::create('pictures', function($table) { $table->increments('id'); $table->text('path'); $table->string('title')->nullable(); $table->text('description')->nullable(); $table->integer('gallery_id')->unsigned(); $table->foreign('gallery_id') ->references('id')->on('galleries') ->onDelete('cascade'); $table->timestamps(); $table->engine = 'InnoDB'; }); 将图库表链接到图片: Schema::table('galleries', function($table) { // id of …