Replies: 1 comment 1 reply
-
|
I was partially mistaken. The --path flag seems to work. The --database does not. After further troubleshooting I figured out that the error comes from the I disabled for now in ide_helper.php: Will need to figure a way how to generate model definitions for models whose database connections are not accessible by default. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I’m working on a Laravel application that uses multiple database connections, and I want to conditionally execute migrations depending on the connection.
Setup
Database Connections
core: Default connection for core application data and user accounts.personal: Used for user-specific data.Goal
coreconnection.personalconnection.What I’ve Tried
Declaring the
$connectionproperty in a migration file, as described in the Laravel documentation:This works for targeting specific connections.
Organizing migrations into separate directories:
database/migrations/coredatabase/migrations/personalThen running commands like:
php artisan migrate --path=/database/migrations/corephp artisan migrate --database=coreUsing the
migrate:freshcommand with similar configurations.Issue
None of these approaches work as expected.
--pathand--databaseoptions do not seem to achieve the desired behavior for conditionally targeting connections. All migrations are executed.Environment
Steps to Reproduce
coreandpersonal) in theconfig/database.phpfile.coreandpersonal.--pathor--databaseoptions.Expected Behavior
The migrations should be executed for the specified connection.
Actual Behavior
Instead of executing the migrations which target specified connections all migrations are executed.
Is this a bug in the recent Laravel version, or am I missing something in the configuration?
Beta Was this translation helpful? Give feedback.
All reactions