Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure migrations use the correct configured database connection #134

Draft
wants to merge 3 commits into
base: 1.x
Choose a base branch
from

Conversation

G4b0rDev
Copy link

This PR ensures that the migration for Pennant use the configured database connection.

Why is this needed?

Currently, the migration does not explicitly set the database connection, which causes issues when using a custom connection for Pennant. As a result, migrations may run on the default connection instead of the intended one.

How does this fix it?

  • Uses getConnection() to ensure the migration runs on the correct database connection.
  • Ensures compatibility for multi-database setups.

Let me know if any adjustments are needed.

@taylorotwell
Copy link
Member

I would make this migration we publish extend a PennantMigration which is in the package and contains this method and extends the base migration. Then the user never sees this method.

@taylorotwell
Copy link
Member

Please mark as ready for review when the requested changes have been made.

@taylorotwell taylorotwell marked this pull request as draft January 31, 2025 08:11
@G4b0rDev
Copy link
Author

G4b0rDev commented Jan 31, 2025

Thank you. I’ve implemented the requested changes.
Should I update the upgrade guidelines to reflect the updated migration extending the new class?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants