increments('id'); $table->timestamps(); $table->unsignedInteger('ancestor_id')->index()->nullable(); $table->unsignedInteger('author_id')->index(); $table->unsignedInteger('table_id')->index(); $table->text('message'); $table->foreign('table_id')->references('id')->on('tables') ->onDelete('cascade'); $table->foreign('author_id')->references('id')->on('users') ->onDelete('cascade'); $table->foreign('ancestor_id')->references('id')->on('table_comments') ->onDelete('set null'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('table_comments'); } }