decentralized-identity / veramo

A JavaScript Framework for Verifiable Data
https://veramo.io
Apache License 2.0
445 stars 133 forks source link

fix(data-store): take and skip for postgres #1249

Closed simonas-notcat closed 1 year ago

simonas-notcat commented 1 year ago

What issue is this PR fixing

When running dataStoreORMGetVerifiableCredentials with :

{
    "order": [
        {
            "column": "issuanceDate",
            "direction": "DESC"
        }
    ],
    "take": 10,
    "skip": 0
}

on an agent that is using Postgres DB you would get this error:

for SELECT DISTINCT, ORDER BY expressions must appear in select list

What is being changed

Using qb.offset() and qb.limit() instead of qb.skip() and qb.take()

As suggested here: https://github.com/typeorm/typeorm/issues/4742#issuecomment-783857414

Quality

Check all that apply:

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (d178603) 84.92% compared to head (1599635) 84.92%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## next #1249 +/- ## ======================================= Coverage 84.92% 84.92% ======================================= Files 167 167 Lines 18120 18120 Branches 2036 2036 ======================================= Hits 15388 15388 Misses 2732 2732 ``` | [Files Changed](https://app.codecov.io/gh/uport-project/veramo/pull/1249?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uport-project) | Coverage Δ | | |---|---|---| | [packages/data-store/src/data-store-orm.ts](https://app.codecov.io/gh/uport-project/veramo/pull/1249?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uport-project#diff-cGFja2FnZXMvZGF0YS1zdG9yZS9zcmMvZGF0YS1zdG9yZS1vcm0udHM=) | `90.39% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.