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

RQB v2 #3974

Open
wants to merge 41 commits into
base: beta
Choose a base branch
from
Open

RQB v2 #3974

wants to merge 41 commits into from

Conversation

Sukairo-02
Copy link
Collaborator

@Sukairo-02 Sukairo-02 commented Jan 20, 2025

Features:

  • RQB v2
  • Fixed sql prefixing aliased tables with schema names
  • More precise type for getTableUniqueName(table)
  • Typed SQLWrapper
  • Fixed and returned neon-http-batch tests
  • Switched sql-js prepare logic to query-builder-side preparation instead of db-side because of the need to .free() connections manually

Breaking changes:

  • Every drizzle database, session, migrator and transaction instance, except, temporarily, singlestore's, gained 2 additional generic arguments for RQB v2 queries
  • Updated DrizzleConfig generic with TRelations argument and relations: TRelations field
  • RQB v1 is now accessed via db.query => db._query
  • Following imports were moved from drizzle-orm, drizzle-orm/relations to drizzle-orm/_relations with RQB v2's alternatives (if such exist) being put in their place:
    • Relation
    • Relations
    • One
    • Many
    • TableRelationsKeysOnly
    • ExtractTableRelationsFromSchema
    • ExtractObjectValues
    • ExtractRelationsFromTableExtraConfigSchema
    • getOperators
    • Operators
    • getOrderByOperators
    • OrderByOperators
    • FindTableByDBName
    • DBQueryConfig
    • TableRelationalConfig
    • TablesRelationalConfig
    • RelationalSchemaConfig
    • ExtractTablesWithRelations
    • ReturnTypeOrValue
    • BuildRelationResult
    • NonUndefinedKeysOnly
    • BuildQueryResult
    • RelationConfig
    • extractTablesRelationalConfig
    • relations
    • createOne
    • createMany
    • NormalizedRelation
    • normalizeRelation
    • createTableRelationsHelpers
    • TableRelationsHelpers
    • BuildRelationalQueryResult
    • mapRelationalRow
  • In the same manner, ${dialect}-core/query-builders/query files were moved to ${dialect}-core/query-builders/_query with RQB v2's alternatives being put in their place
  • Removed .free() from sql-js

…` field, RQB v1 entities to `_relations.ts`, added template to SQLWrapper for return type inferrence, switched RQB-related local tests & type tests to use `._query`
…thReplicas()` compatibility (to be reworked), switched tests to use `_query` method for RQB v1 tests
… fixed, simplified query builders, added JSON parsing for top level SQLite response mapper, fixed aggregated relation count sql
… relational configs, resolved potential type overlaps with similar table names from different schemas on query results, resolved relation builders allowing usage of columns from table with same name from different schema
…ypes to tables instead of column records, relational tests v2 for postgresql, updated relations .where field names, added error on nothing selected from table in relational queries v2
…RQB V2, removed unnecessary argument from `WithContainer` generics
…ional relation results, added forced relation optionality for queries with additional filters, fixed libsql rqb pre-mapping and transaction result mapping, added libsql RQBv2 tests, added new RQB test cases related to aforementioned changes
…joins and `json_arrayagg()`'s `order by` order preservation, removed unused code, added error throw to incomplete RQBv2 feature `.through()`
…d planetscale tests for RQB v2, added common RQB tests for pg dialect drivers
…non-optional relations, defaulted relations to optional, allowed full booleans in RQB query config's `with` section, moved `coalesce` in pg RQB for consistency
…proxy session RQB fixes, fixed missing `TRelations` arguments in generics
…lback getting columns passed to first argument instead of full table
@AndriiSherman AndriiSherman self-requested a review January 21, 2025 12:02
@hajek-raven
Copy link
Contributor

hajek-raven commented Jan 21, 2025

Great work!
It'd be really nice, if this problem with deeply nested queries could be solved in V2. #2066

@AndriiSherman
Copy link
Member

AndriiSherman commented Jan 21, 2025

Great work! It'd be really nice, if this problem with deeply nested queries could be solved in V2. #2066

this problem does not exist is rqb v2

@Ileies
Copy link

Ileies commented Jan 21, 2025

This is so exciting. What a coincidence I'm here only 3 minutes after the latest check!!
Will Postgres' WITH RECURSIVE work in there as well?

…itched `sql-js` prepare logic to query-builder-side preparation instead of db-side because of the need to free connections manually
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.

4 participants