Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JoaoHamerski's avatar

How 'migrations' table works in Laravel?

I have 3 connections configured on my application each one with a different database:

  • mysql
  • mysql_connection2
  • mysql_connection3

Currently i'm only using mysql_connection2 and mysql_connection3, i migrated some tables to these two connections that are located in different folders using the commands:

  • php artisan migrate --path=database/migrations/connection2
  • php artisan migrate --path=database/migrations/connection3

So the issue here is, i couldn't find the migrations table, Laravel just didn't created the migrations table in these two connections, so looking for that i found the migrations table on my first connection database mysql, so can someone explain me how migrations table works? And how can i specify to Laravel create one migration to each connection when i migrate my tables?

0 likes
2 replies
jlrdw's avatar
jlrdw
Best Answer
Level 75

Create the migration you need for the other connections yourself. And as the previous question make sure you pass that connection when migrating.

1 like
jlrdw's avatar

Also make sure you have set up these other Connections in the database config file.

Please or to participate in this conversation.