Support the ongoing development of Laravel.io →
posted 10 years ago
Last updated 2 years ago.
0

As far as I know, a migration will only run on one database at the time... Is this not the case for you?

I thought you have to add --database=myotherconnection to get migrations to run for a non-default connection.

Last updated 2 years ago.
0

I will look into building a solution. The --database flag allows you to toggle the migrations for a non-default connection but does not allow you to choose which migrations are applied to which db.

Last updated 2 years ago.
0

Thank you for you assistance anyhow. It's appreciated.

Last updated 2 years ago.
0

You can do this:

Schema::connection('other_database')->create(....)
Last updated 2 years ago.
0

You can create different folders for some of the migrations such as shared or however you want and use the --path option when running migrations. Then, only the migrations in that folder will run.

For example I use a folder named tenants to store all account migrations (tables that hold all the users data) for a SaaS app. Then I use the default migrations folder to store things relating to authentication, password reminders, and anything else related to all user accounts.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

harryx9x9 harryx9x9 Joined 31 Jan 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.