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
core
connection.personal
connection.What I’ve Tried
Declaring the
$connection
property in a migration file, as described in the Laravel documentation:This works for targeting specific connections.
Organizing migrations into separate directories:
database/migrations/core
database/migrations/personal
Then running commands like:
php artisan migrate --path=/database/migrations/core
php artisan migrate --database=core
Using the
migrate:fresh
command with similar configurations.Issue
None of these approaches work as expected.
--path
and--database
options do not seem to achieve the desired behavior for conditionally targeting connections. All migrations are executed.Environment
Steps to Reproduce
core
andpersonal
) in theconfig/database.php
file.core
andpersonal
.--path
or--database
options.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