bigIncrements('id'); $table->unsignedBigInteger('photo_id'); $table->string('commentor_name'); $table->string('commentor_email'); $table->text('comment_text'); $table->unsignedInteger('created_user_id')->nullable(true); $table->unsignedInteger('approved_user_id')->nullable(true); $table->dateTime('approved_at')->nullable(true); $table->unsignedBigInteger('parent_comment_id')->nullable(true); $table->timestamps(); $table->foreign('photo_id') ->references('id')->on('photos') ->onDelete('cascade'); $table->foreign('created_user_id') ->references('id')->on('users') ->onDelete('cascade'); $table->foreign('approved_user_id') ->references('id')->on('users') ->onDelete('cascade'); $table->foreign('parent_comment_id') ->references('id')->on('photo_comments') ->onDelete('cascade'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('photo_comments'); } }