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

feat: schema engine postgres WASM implementation #5136

Merged
merged 8 commits into from
Jan 30, 2025

Conversation

jacek-prisma
Copy link
Contributor

@jacek-prisma jacek-prisma commented Jan 24, 2025

Closes ORM-506. Implements most of the schema engine API for Postgres for WASM.

Notes:

  • missing apply_migration_script, create_database, drop_database, shadow database
  • had to refactor quite a lot of code for reasons below:
    • error handling must be a bit different for WASM because we get different errors in the WASM impl of quaint traits, I aimed to preserve the exisiting native behavior, while also having reasonable WASM errors
    • native driver code passes around connection URLs very frivolously and we don't have a connection URL in WASM
    • I've changed sqlite a little bit to make it more similar to the postgres code
    • had to introduce a trait for postgres SqlSchemaDescriber to make it compile against external connector

@jacek-prisma jacek-prisma requested a review from a team as a code owner January 24, 2025 10:06
@jacek-prisma jacek-prisma requested review from FGoessler and removed request for a team January 24, 2025 10:06
Copy link
Contributor

github-actions bot commented Jan 24, 2025

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.120MiB 2.120MiB 0.000B
Postgres (gzip) 848.487KiB 848.488KiB -1.000B
Mysql 2.082MiB 2.082MiB 0.000B
Mysql (gzip) 834.400KiB 834.399KiB 1.000B
Sqlite 1.990MiB 1.990MiB 0.000B
Sqlite (gzip) 797.977KiB 797.976KiB 1.000B

Copy link

codspeed-hq bot commented Jan 24, 2025

CodSpeed Performance Report

Merging #5136 will not alter performance

Comparing feat/schema-engine-postgres-wasm (c306ec9) with main (4767cae)

Summary

✅ 11 untouched benchmarks

@jacek-prisma jacek-prisma requested a review from jkomyno January 24, 2025 15:44
Comment on lines -411 to +371
Box::pin(self.raw_cmd("DROP TABLE _prisma_migrations"))
self.raw_cmd("DROP TABLE _prisma_migrations")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in a call, we were previously applying Box::pin twice by accident, so this change is fine.

Copy link
Contributor

@jkomyno jkomyno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one! The git diff in this case is more drastic than it should be, most of the files that appear deleted are actually moved to another file

@jacek-prisma jacek-prisma merged commit 476ed35 into main Jan 30, 2025
366 of 367 checks passed
@jacek-prisma jacek-prisma deleted the feat/schema-engine-postgres-wasm branch January 30, 2025 18:59
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.

2 participants