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:
the table itself needs to be renamed
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
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?