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

[pull] main from prisma:main #122

Open
wants to merge 668 commits into
base: main
Choose a base branch
from
Open

[pull] main from prisma:main #122

wants to merge 668 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Jun 12, 2023

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

jkomyno and others added 28 commits February 1, 2024 17:05
* feat: update napi

* test: uncomment some tests that actually work after napi's update
Makes `wasm2wat` available in the PATH.
Implement relation aggregations support for the `join` strategy:

* Build relation aggregation queries in the new query builder

* Add new methods to the abstractions that represent selections to account for
  differences in representation in queries that use or don't use JSON objects

* Implement coercion and serialization logic

Next step: prisma/team-orm#903

Part of: prisma/team-orm#700
Closes: prisma/team-orm#902
- Fix all clippy warnings in tests using `cargo clippy --fix
  --all-targets` (nothing required manual action).

- Change the `clippy` command in the GitHub Actions pipeline to check
  the whole codebase.
* feat: update napi

* test: uncomment some tests that actually work after napi's update

* feat: uncommented Driver Adapter tests, add comments
* feat: bump @planetscale/database to 1.15.0

* test(driver-adapters): fix prisma/team-orm#687, DRIVER_ADAPTERS_BRANCH=feat/update-planetscale

* chore: fix typo, DRIVER_ADAPTERS_BRANCH=feat/update-planetscale

* [skip ci] chore: fix indentation
* qe-wasm: Split query engine by connector

Intoroduces separate features for mysql, postgresql and sqlite
connectors and builds 3 individual engines for each. All engines are put
and published as a single package (with connector-specific) engine in
subdirectory. It is up to a client to pick the correct one.

Contributes to prisma/team-orm#891

* feat: some of the review comments

* Fix size job

* Fix size again
Follow up to #4681

Contributes to prisma/team-orm#891
)

* chore: fix clippy

* chore: fix clippy

* chore: fix clippy

* chore: fix test

* chore: uncomment test for pg/neon (Wasm)

* chore: fix tests

* chore: remove esbuild-register

* chore: downgrade version of @prisma/query-engine-wasm from latest to 5.10.0-8.092a72727fdea55b88bdb6f7f5fc480326b237ac

* chore: upgrade version of @prisma/query-engine-wasm back to latest, fixing its types in driver-adapters/executor

* chore: add comment related to query-engine-wasm-latest
`numfmt -100` interprets `-100` as a cli flag and complains, passing
input via stdin fixes it
Add missing `relation_load_strategy` field in the manual `Debug` impl
for `QueryArguments` struct.
If protocol is not specified explicitly and `--enable-playground` flag
is used, engine will default to GraphQL instead of JSON.

Close #4679

Co-authored-by: Joël Galeran <[email protected]>
* qe-wasm: Remove `Buffer` usage

Convert `Byte` arguments to `Uint8Array` instead.

Allows us to stop polyfilling `Buffer` for `_bg.js` fiels in engine.

* Support that for napi too
…4721)

* driver-adapters: Pin drivers to the versions, used in prisma/prisma

See prisma/prisma#23087
Removes direct depenencies on the driver packages and picks them from
the meta-package in prisma/prisma. Should avoid disaster on every
update.

Fix prisma/team-orm#940

* Read GITHUB_BRANCH in benchmarks job too

* DRIVER_ADAPTERS_BRANCH=chore/bundled-js-drivers
* Fix JSON serialization of bigints

* wasm-benchmarks: apply lateral joins when possible, and return rel fields in results  (#4691)

* Store recordings if requested and use joins

* More traversal and serialization

* Create recordings for all the different engines as they might be using different SQL queries.

* Remove stale comment
* Generate the same output as nix when measuring size

* Don't use nix in wasm-size.yml, and wasm-benchmarks.yml

* Fix wasm-size job

* Point base branch to head

* Bring back rustup in the build script. Should be a no-op

* Get rid of nix in publish-query-engine-wasm

* Add build-qe-wasm to Makefile

* Also output size of all providers

* Do not publish cargo docs

* WASM_SIZE_OUTPUT to ENGINE_SIZE_OUTPUT

* Try extracting deps for rust-wasm into a workflow

* Move rust-wasm-setup

* Add check-schema-wasm make target

* Make rust wasm setup a composite workflow

* Render prisma-schema-wasm version in package.json

* add newline

* Specify shell following action metadata syntax

* Let the build script add targets and components

* Pin nightly

* Use relative path to scripts because we are always in the repo root

* Try to use rustup included in action runners

* add wasm-pack and wasm-opt

* Driver adapter tests

* Add clean wrappers

* Remove unnecessary building step

* use make target in build-prisma-schema-wasm workflow

* update publish-prisma-schema-wasm pipeline

* Fix

* remove outdated comment

* update PENDING.md

* fix measure size

* Remove things from PENDING.md

* Use cargo binistall to accelerate binary installation

* Fix previous bug in WASM_BUILD_PROFILE

* add wasm target for schema-wasm

* Use standard posix bc syntax

* deduplicate wasm target

* Output sizes in bytes, no KiB

* Remove PENDING.md

* Ping cargo binstall versions

* Remove nix files except the shell

* Be intentional about the use of nix

* Extract toml config to rust-toolchain.toml

cherry-picked from #4699

* Fix shellcheck

* Fix publishing prisma-schema-wasm

* Address some feedback

* Revert rust-toolchain.toml

* Remove engine size publishing from pipeline momentarily. Read more

Extracted from the scope to: https://github.com/prisma/team-orm/issues/943

* Take back publishing engine sizes

* Update flake.nix

---------

Co-authored-by: Alexey Orlenko <[email protected]>
The initial implementation always adds LEFT JOINs for relation aggregations. This is not necessary if there is an existing JOIN for fetching the relation data with the same filters (which includes no filters in both cases).

This PR optimizes the query by reusing the existing lateral joins that load relation data and aggregating the relation in the same subquery when possible.

Ref: prisma/team-orm#700
Closes: prisma/team-orm#903
* qe: Map "Too many connections" errors to code P2037

Contributes to prisma/team-orm#945

* Update libs/user-facing-errors/src/query_engine/mod.rs

Co-authored-by: Flavian Desverne <[email protected]>

* Preserve original error

---------

Co-authored-by: Flavian Desverne <[email protected]>
Both the old query builder and the new query builder append virtual
selections after all other selections in the query. This means we have
to take it into account instead of relying on the fields in the result
set to be in the same order as in `FieldSelection`.

The old code path converted the selection into virtuals-last form but
the new one didn't, which resulted in the cached indexes for the
relations and virtuals to be mixed up when selecting relation
aggregations before the relations in the query.

Now the new code path does the same transformation.

Fixes: prisma/team-orm#927
This was commented out in
#4713 to make the pipeline
pass in the PR because the changes weren't compatible with the pipeline
on `main` with the intention to uncomment immediately after landing the
changes, see
#4713 (comment).
Fixes the following warning when compiling the tests:

```
warning: unused variable: `adapter`
  --> query-engine/request-handlers/src/load_executor.rs:28:29
   |
28 |         ConnectorKind::Js { adapter, _phantom } => {
   |                             ^^^^^^^ help: try ignoring the field: `adapter: _`
   |
   = note: `#[warn(unused_variables)]` on by default
```
…al (#4730)

wasm-bindgen code, generated by `Option<Performance>` binding still does
not account for global not existing at all (it just handles
undefined/null case).
Replacing that with hand-written code that would check it existence
manually.
jkomyno and others added 30 commits August 26, 2024 11:30
…s ownership in repository" errors on `git` (#4986)

* feat: add sanity check to build.rs scripts on crates compiled natively

* fix(ci): fix build on linux-musl and linux-static architectures

* chore: trigger [integration]

* chore: trigger [integration], allow COLLABORATOR roles
…4992)

Follow-up to #4986.

* Change the `build.rs` scripts to pass through the `GIT_HASH`
  environment variable if it's already set.

* Set dummmy `GIT_HASH` value in the Nix packages used in the
  engines size dashboard.

* Consistently use the new logic everywhere.

Fixes: #4991
Closes: prisma/team-orm#1261
* test(query-engine): add regression test for prisma/prisma#25103

* Fix the IDs in schema_25103

* Add the actual failing query in prisma_25103

* Add repro for 25104

* Support m2m in join_fields

* Exclude mongodb for now

* Add a test with different pk names

* Update the test to be closer to the user's query

Co-authored-by: Alberto Schiabel <[email protected]>

---------

Co-authored-by: jkomyno <[email protected]>
Co-authored-by: Alberto Schiabel <[email protected]>
* Revert "chore(deps): bump openssl from 0.10.60 to 0.10.66 (#4965)"

This reverts commit ae18f91.

* chore(ci): stop showing commit message to avoid bad substitutions like https://github.com/prisma/prisma-engines/actions/runs/10664988277/job/29557431036\?pr\=4995\#step:4:13
* fix(driver-adapters): fix transaction ordering for ISOLATION LEVEL, impacting PlanetScale

* chore(driver-adapters): uncomment fixed PlanetScale tests

* chore: retrigger CI

* feat(driver-adapters): add support for TransactionContext

* test(connector-test-kit-rs): uncomment succeeding "basic_serializable" test

* chore(driver-adapters): fix types in executor

* DRIVER_ADAPTERS_BRANCH=feat-driver-adapters-transaction-context retrigger CI/CD

* feat(driver-adapters): impl Send on JsTransactionContext on wasm32

* DRIVER_ADAPTERS_BRANCH=feat-driver-adapters-transaction-context retrigger CI/CD

* feat(driver-adapters): impl FromJsValue for JsTransactionContext on wasm32

* DRIVER_ADAPTERS_BRANCH=feat-driver-adapters-transaction-context retrigger CI/CD

* feat(driver-adapters): impl Send for TransactionContextProxy on wasm32

* DRIVER_ADAPTERS_BRANCH=feat-driver-adapters-transaction-context retrigger CI/CD

* chore: attempt Send/Sync-compatibility for JS transactions

* chore: add "parse_raw_query" to "JsTransactionContext"

* fix(driver-adapters): enable wasm32 compilation of "JsQueryable::start_transaction"

* chore: remove commented-out method

* test(connector-test-kit-rs): uncomment "interactive_tx" tests

* DRIVER_ADAPTERS_BRANCH=feat/driver-adapters-transaction-context chore: retrigger CI/CD

* tmp(connector-test-kit-rs): add (failing) concurrent_create_select regression test

* Revert "tmp(connector-test-kit-rs): add (failing) concurrent_create_select regression test"

This reverts commit cc0baab.

* DRIVER_ADAPTERS_BRANCH=feat/driver-adapters-transaction-context chore: retrigger CI/CD

* feat(driver-adapters): rename "parse_raw_query" to "describe_query" after #4979

* DRIVER_ADAPTERS_BRANCH=feat/driver-adapters-transaction-context chore: retrigger CI/CD

* chore: don't leak concrete UnsafeFuture types

* chore(driver-adapters): nit, replace "::napi" with "napi"

* Revert "chore(driver-adapters): nit, replace "::napi" with "napi""

This reverts commit 808fdbe.

* DRIVER_ADAPTERS_BRANCH=feat/driver-adapters-transaction-context chore: retrigger CI/CD

* chore: unbox JsTransactionContext

* DRIVER_ADAPTERS_BRANCH=feat/driver-adapters-transaction-context chore: retrigger CI/CD
* qe: Add "strictUndefinedChecks" preview feature

* Update snapshots
* fix(ci): add fix for SQL Server 2017

* fix(ci): fix schema-engine for SQL Server 2017

* fix(ci): forward ubuntu version to test-query-engine-template

* chore: trigger Rust tests

* chore(core-tests): undo changes to build.rs

* chore: trigger Rust tests
…straint violation error (#5002)

* fix(quaint): extract constraint name from cockroachdb foreign key constraint violation error

* chore: normalise "regex" version across multiple crates

* chore: adjust test assertions for "ForeignKeyViolation"

* chore: adjust test assertions for "ForeignKeyViolation"

* test(quaint): add explicit regression test for issue prisma/prisma#24072, via new macro "assert_connector_error"

* fix(ci): add fix for SQL Server 2017

* fix(ci): fix schema-engine for SQL Server 2017

* chore: get rid of leftover comments

* test(quaint): fix tests for MySQL 5.6, 5.7, and MongoDB

* chore: get rid of CI: True

* Revert "fix(ci): fix schema-engine for SQL Server 2017"

This reverts commit 5aebbbf.

* Revert "fix(ci): add fix for SQL Server 2017"

This reverts commit f7cdacd.

* test(quaint): fix for PlanetScale

* test(quaint): fix tests for PlanetScale
Add full queries to the `prisma:engine:db_queries` spans in MongoDB.

Closes: prisma/prisma#24463
* [WIP]: Migrations over WebSocket

* Avoid panics in error handling code

* Fix compilation

* Handle unauthorized error

* Fix wasm build

* Cargo fmt

* Use correct urls

* Restore Cargo.toml

* Fix TLS and api_key

* TLS support

* Fix fixed TLS

* Implement TLS handshake with proper host name

* Update quaint/src/connector/postgres/native/websocket.rs

Co-authored-by: Alberto Schiabel <[email protected]>

* Remove dbg

* Feedback & cleanup

---------

Co-authored-by: Alberto Schiabel <[email protected]>
…regression (#5018)

* feat(crosstarget-utils): add Wasm-friendly regex util

* fix(query-engine-wasm): reduce size of postgres Driver Adapter via Wasm-friendly regex util

* chore: fix clippy

* chore: fix clippy

* chore: review comments

* feat(crosstarget-utils): introduce common trait "RegExprCompact" for "regex" util

* chore(crosstarget-utils): rewrite comment

* chore(review): use derive_more Display

Co-authored-by: Alexey Orlenko <[email protected]>

* fix(crosstarget-utils): don't change the number of captured groups in regex

* fix(crosstarget-utils): fixes on regex and derive_more

* chore: apply nits

* feat(crosstarget-utils): replace every manual "Display" instance with "derive_more"

---------

Co-authored-by: Alexey Orlenko <[email protected]>
* fix(schema-engine): Ensure WS migrations can use shadow database

Previousy, when creating shadow DB connection over websocket, we
connected to the same DB which broke in every `migrate` case except the
one that starts with clean migration history.

This PR ensures it works normally. Implementation is quite cursed
though: for WS we now allow to override db name via `dbname` query
string parameter. If set, we ignore `dbname` that we got from migration
server and use provided DB with the same username and password. Shadow
DB then uses this query string parameter to specify the url.

Close ORM-325

* Clippy + rustfmt
* Update nix flake

* Update Rust to 1.81.0

* Fix compiler warning for unused errors

We keep these around for documentation purposes.

* Fix clippy warnings

* Update wasm-bindgen to match the version in Nix

* Update WASM toolchain to nightly-2024-09-01 (corresponds to Rust 1.82.0)

* Fix deprecation warning on Rust 1.82

* Update rust overlay in nix

* Update Rust to 1.82.0

* Fix clippy warnings
Co-authored-by: Alexander Polanco <[email protected]>
Co-authored-by: Alberto Schiabel <[email protected]>
* feat(telemetry): add dynamic "db.system" attribute to OTEL spans

* chore: clippy

* chore(driver-adapters): add "db_system_name()" to "AdapterFlavour"

* chore(driver-adapters): rename SYSTEM_NAME to DB_SYSTEM_NAME, and change member variable to constant

* chore(driver-adapters): get rid of db_system_name(), adapt name() on Connector trait

* chore(driver-adapters): fix typos

* chore: clippy

* chore: fix compilation on wasm32

* feat(tracing): add "otel.kind" = "client" on query spans

* chore: fix Wasm compilation

* feat(core): extract otel_kind from span attributes

* chore(core): clippy

* chore(core): remove percentage sigil for constant strings

* chore(core): rename "system_name" to "db_system_name"

* feat(core): add mongodb-specific "db.collection.name" and "db.operation.name" attributes in spans

* chore(core): review comments

* chore: Update query-engine/connectors/mongodb-query-connector/src/root_queries/mod.rs

Co-authored-by: Alexey Orlenko <[email protected]>

* chore: address review comments

---------

Co-authored-by: Alexey Orlenko <[email protected]>
* Move query-engine-metrics to libs

* Use prisma_metrics in quaint

* Merge metrics-guards into prisma-metrics

* Encapsulate metrics inside prisma-metrics

* Forward subscriber and recorder in quaint tasks

* [integration]

* rustfmt

* [integration]

* Forward subscriber and recorder to mobc

* Remove the global recorder fallback

* [integration]
After some recent dependency changes, building with Nix on Darwin also
requires having `SystemConfiguration.framework`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.