Skip to content

fixed QueryBuilder connection caching#961

Open
circulon wants to merge 2 commits into
MasoniteFramework:3.xfrom
circulon:fix/960_fix_querybuilder_internal_connection
Open

fixed QueryBuilder connection caching#961
circulon wants to merge 2 commits into
MasoniteFramework:3.xfrom
circulon:fix/960_fix_querybuilder_internal_connection

Conversation

@circulon

Copy link
Copy Markdown
Contributor

fixes #960
new_connection() now just creates a connection and returns it
get_connection() handles the internal connection var management

new_connection() now just creates a connection and returns it
get_connection() handles the internal connection var
eaguad1337 pushed a commit to masonitedev/orm that referenced this pull request Jun 7, 2026
…QueryBuilder

Ported from MasoniteFramework/orm#959 and MasoniteFramework/orm#961.

- new_connection() is now a pure factory: it always creates and returns a
  fresh connection without storing it, allowing independent connections to
  be used alongside each other.
- get_connection() now owns the cached-connection lifecycle and is used by
  all internal call sites.
- Schema previously recreated its connection before every DDL call, which
  could exhaust backend connection limits during migrations.
- Adds Schema.query_builder() to get a QueryBuilder bound to the same
  connection settings, useful for arbitrary queries (DDL, SET) during
  migrations.
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.

1 participant