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

adjustments for knex v1 and v2 #15

Merged
merged 3 commits into from
Mar 28, 2023

Commits on Mar 23, 2023

  1. Configuration menu
    Copy the full SHA
    c270619 View commit details
    Browse the repository at this point in the history

Commits on Mar 27, 2023

  1. adjustments for knex v1+

    knex v1+ changed the return values when `.returning()` clause is used (affecting postgres), before it returned array of primitive values if only 1 column was selected to be returned (e.g. `[1]` for `.returning('id')`) but now it always returns objects (e.g. `[{ id: 1 }]` for `.returning('id')`).
    
    Slightly reorganized `InsertOperation`, instead of calling `createModels` in `doExecute()` (right after `onRawResult` hook) and having "empty" model instances created there, possibly with undefined / declared default properties which would later overwrite input models in `InsertOperation.onAfter1`, offload the handling to `InsertOperation.onAfter1`, which now uses also `setDatabaseJson`, same as `createModels` function, to be consistent.
    
    Additionally, adjusted `$parseDatabaseJson` in `GraphInsert` integration tests, to only parse boolean values when they are present in `json`.
    
    related change in knex v1.0: knex/knex#4471
    falkenhawk committed Mar 27, 2023
    Configuration menu
    Copy the full SHA
    a79c334 View commit details
    Browse the repository at this point in the history

Commits on Mar 28, 2023

  1. introduced new (or missing) knex querybuilder's methods

    to make shapes of both querybuilders as close to each other as possible.
    Most of the methods were introduced in knex v1.
    - `fromRaw`
    - `whereLike`
    - `andWhereLike`
    - `orWhereLike`
    - `whereILike`
    - `andWhereILike`
    - `orWhereILike`
    - `withMaterialized`
    - `withNotMaterialized`
    - `jsonExtract`
    - `jsonSet`
    - `jsonInsert`
    - `jsonRemove`
    - `whereJsonObject`
    - `orWhereJsonObject`
    - `andWhereJsonObject`
    - `whereNotJsonObject`
    - `orWhereNotJsonObject`
    - `andWhereNotJsonObject`
    - `whereJsonPath`
    - `orWhereJsonPath`
    - `andWhereJsonPath`
    and one new `JoinBuilder` method - `andOnJsonPathEquals` (referencing knex's `JoinClause` method of the same name)
    
    `whereJson(Not)SupersetOf` / `whereJson(Not)SubsetOf` are now supported by knex >= 1.0, but for now
    objection handles them differently and only for postgres.
    Changing them to utilize knex methods directly may require a major version bump and upgrade guide.
    
    Added a test for checking JoinBuilder methods to be inline with knex's JoinClause.
    
    Fixed incorrect checking QueryBuilder methods if they are inline with knex's QueryBuilder.
    
    Added typings for new methods.
    
    Bumped knex `peerDependency` from `>=0.95.13` to `>=1.0.1` because of new methods.
    falkenhawk committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    2a4c137 View commit details
    Browse the repository at this point in the history