I'm creating two tables that reference each other's columns-
> create_conversations_table $table->bigIncrements('id'); ... ... $table->unsignedBigInteger('last_message_id'); $table->timestamps();
and then I've the messages table -
> create_messages_table $table->unsignedBigInteger('id'); $table->unsignedBigInteger('conversation_id'); ... ... $table->timestamps();
Now, I wish to have the following in my conversations table -
and on messages table -
As of now, I can only have either of the two depending upon which migration runs first. Is there a way to do this? Or should I go for creating a separate migration that sets the foreign key references on these two tables?
What'd be your suggestion?