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:
    | Migration Repository Table
    | This table keeps track of all the migrations that have already run for
    | your application. Using this information, we can determine which of
    | the migrations on disk haven't actually been run in the database.
    'migrations' => 'migrations',
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!

No comments or questions yet...

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 50 courses (910 lessons, total 46 h 42 min)
  • 69 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord

Recent Premium Tutorials