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

feat: support multiple database connections #1879

Open
wants to merge 6 commits into
base: 2.x
Choose a base branch
from

Conversation

calebdw
Copy link
Contributor

@calebdw calebdw commented Mar 12, 2024

  • Added or updated tests
  • Documented user facing changes

Closes #1577, closes #1642

Note that this depends on #1838 as it built on top of the refactoring in that branch.

Changes

This PR introduces support for multiple database connections as well as Postgres Schema (sub databases).

Breaking changes
None that should affect the user, but the existing code allowed for parsing multiple schema files for a single connection (i.e., the only connection). However, Laravel saves the schema squash files as <connection>-schema.sql. So to able to understand which schema file belongs to what connection I rely on this naming convention to determine the connection name from the filename. In practice this means there should only be one file per connection.

For example, the following files would both be parsed under the mysql connection:

  • mysql-schema.{sql,dump}
  • mysql.{sql,dump}

@TaylorWilton
Copy link

Hey @calebdw @canvural what's the status of this PR?

I'm currently leading a project at work to bump our level from 0 to 1, by generating a baseline & removing errors from the baseline each week.

I didn't realise until recently that Larastan doesn't support multiple connections. We have 17 database connections, and make heavy use of Postgres schemas, so this has become a stumbling block.

For now, I've switched to @calebdw's fork to keep momentum going, but would love to see it merged in.

Thanks for all the hard work y'all put in maintaining this library!

@calebdw
Copy link
Contributor Author

calebdw commented May 3, 2024

@TaylorWilton, this PR should be ready to go, just waiting for @canvural to merge :)

@calebdw calebdw closed this May 3, 2024
@calebdw calebdw reopened this May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants