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

test(cli): e2e migrations for D1 #24214

Merged
merged 14 commits into from
May 28, 2024
Merged

test(cli): e2e migrations for D1 #24214

merged 14 commits into from
May 28, 2024

Conversation

jkomyno
Copy link
Contributor

@jkomyno jkomyno commented May 15, 2024

This PR adds automated tests for Cloudflare D1 migrations with Prisma https://www.prisma.io/docs/orm/overview/databases/cloudflare-d1#migration-workflows.
It also showcases that #24208 is now fixed via prisma/prisma-engines#4871.

This PR relies on an integration release of prisma/prisma-engines#4871 (currently being built).

Note: It's currently added to the cli package because of a previous attempt at using prisma generate within the test. Still, since at some point we will add prisma db seed support for D1, I think we can keep the CLI e2e tests there.

@jkomyno jkomyno added this to the 5.15.0 milestone May 15, 2024
Copy link
Contributor

github-actions bot commented May 15, 2024

size-limit report 📦

Path Size
packages/client/runtime/library.js 179.82 KB (0%)
packages/client/runtime/library.d.ts 81 B (0%)
packages/client/runtime/binary.js 600.89 KB (0%)
packages/client/runtime/binary.d.ts 26 B (0%)
packages/client/runtime/edge.js 159.02 KB (0%)
packages/client/runtime/edge-esm.js 158.91 KB (0%)
packages/client/runtime/wasm.js 114.9 KB (0%)
packages/client/runtime/index-browser.js 33.77 KB (0%)
packages/client/runtime/index-browser.d.ts 89 B (0%)
packages/cli/build/index.js 2.09 MB (0%)
packages/client/prisma-client-0.0.0.tgz 2.92 MB (0%)
packages/cli/prisma-0.0.0.tgz 3.73 MB (0%)
packages/bundle-size/da-workers-libsql/output.tgz 857.73 KB (0%)
packages/bundle-size/da-workers-neon/output.tgz 934.46 KB (0%)
packages/bundle-size/da-workers-pg/output.tgz 953.04 KB (0%)
packages/bundle-size/da-workers-pg-worker/output.tgz 908.76 KB (0%)
packages/bundle-size/da-workers-planetscale/output.tgz 870.73 KB (0%)
packages/bundle-size/da-workers-d1/output.tgz 830.8 KB (0%)

Copy link

codspeed-hq bot commented May 15, 2024

CodSpeed Performance Report

Merging #24214 will not alter performance

Comparing feat/d1-migrations-tests (3c668d7) with main (c794bba)

Summary

✅ 3 untouched benchmarks

Copy link

socket-security bot commented May 16, 2024

No dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No dependency changes detected in pull request

@jkomyno jkomyno changed the base branch from main to integration/engines-5.15.0-4.integration-fix-sqlite-d1-migrations-93d288241fddb3768c310aeceb6b0120145c6f6d May 17, 2024 02:43
…migrations-93d288241fddb3768c310aeceb6b0120145c6f6d' into feat/d1-migrations-tests
@jkomyno jkomyno marked this pull request as ready for review May 17, 2024 08:05
@jkomyno jkomyno requested a review from a team as a code owner May 17, 2024 08:05
@jkomyno jkomyno requested review from Druue and removed request for a team May 17, 2024 08:05
@Jolg42 Jolg42 self-requested a review May 28, 2024 09:25
@Jolg42
Copy link
Member

Jolg42 commented May 28, 2024

Note: the base branch needs to be changed later

@jkomyno
Copy link
Contributor Author

jkomyno commented May 28, 2024

Note: the base branch needs to be changed later

Yep, I was waiting for the engines to compile, so you could see the list of green marks on the CI :)

@jkomyno jkomyno changed the base branch from integration/engines-5.15.0-4.integration-fix-sqlite-d1-migrations-93d288241fddb3768c310aeceb6b0120145c6f6d to main May 28, 2024 09:40
Copy link
Member

@Jolg42 Jolg42 left a comment

Choose a reason for hiding this comment

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

Looks good!

The tests in general are really long because they intend to test end to end.

For some cases it would be nice, especially if we want to add more tests later to make them shorter by manually creating an init migration which contains all what is needed.

Example: (empty) -> apply init migration which also contains some data -> try to apply the next migration that should fail

Because it's ok to have a couple of long tests for e2e purposes, but it's not easy to maintain if we copy and paste them many times.

@jkomyno jkomyno merged commit 29a309f into main May 28, 2024
214 checks passed
@jkomyno jkomyno deleted the feat/d1-migrations-tests branch May 28, 2024 12:52
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.

None yet

3 participants