configuration

Change Default Migrations DB Table in Config

By default, Laravel migration mechanism stores all the operations in database table migrations. Did you know that you can change it? I will show you how and why would you need it.

Imagine, you have a project and there’s another project that should be merged – like a multi-tenant, or separate blog, or something like that. But it should use the same database. How not to screw up with migrations?

This is where migrations configuration comes in. Go to file config/database.php and find this:

So in your second project (on a sub-domain or sub-folder) you can specify a different migrations table like migrations_blog or something. And then you will be able to safely run artisan migrate command on that other project.

In general, I would encourage you to go through config folder of Laravel and check out different settings and their default values. Some of them are not mentioned in the official documentation, so might be really useful!

Want more tips and articles like this?
Subscribe to our weekly newsletter - comes out every Thursday!
Join 1200+ Laravel professionals who read the issue weekly.

Leave a Reply

Your email address will not be published. Required fields are marked *