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

cwhite's avatar
Level 19

Rename Laravel migration table

Hi folks,

Our migrations table is currently name core_migrations (#legacy) and I would like to update the name to migrations. How exactly do I go about doing this without breaking things in the interim?

Fundamentally, there's two changes that need to be made:

  1. the table itself needs to be renamed
  2. the database.migrations config value needs to be updated

Seems simple enough at first glance, but there's a chicken/egg problem here. Before a migration is executed Laravel checks the table to see if it's a new migration, and after it executes Laravel stores that information in the table. This means that the rename and config change cannot both happen at the same time and the config change cannot happen before the table rename

Thoughts?

Thanks!

0 likes
3 replies
Snapey's avatar
Snapey
Best Answer
Level 122

Could you add some logic into the config/database.php so that it detects the table name for itself and returns the correct name? I know it depends on the order in which the config is read by the migrations process.

An alternative option is to setup two migration tables. Create a new table called migrations, revert the config to the new table name then run the migration. After this, merge the old data into the new table and delete the original?

cwhite's avatar
Level 19

Hmmm, maybe---almost seems easier to just manually update the table name before the release

Please or to participate in this conversation.