Skip to content

Conversation

G4b0rDev
Copy link
Contributor

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
Contributor 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?

@timacdonald timacdonald marked this pull request as ready for review February 10, 2025 22:22
@timacdonald
Copy link
Member

@G4b0rDev, I don't think we need to update the docs. We publish the migration, so the user owns it and could make this change locally if they needed.

@taylorotwell taylorotwell merged commit e32e4ec into laravel:1.x Feb 11, 2025
10 checks passed
@G4b0rDev G4b0rDev deleted the migration-connection branch February 11, 2025 18:57
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.

3 participants