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

Support Prisma SHADOW_DATABASE_URL #7350

Merged
merged 11 commits into from
Jun 23, 2022

Conversation

chelkyl
Copy link

@chelkyl chelkyl commented Mar 13, 2022

Rationale: When using shadow databases, you must use the shadowDatabaseUrl API field per the Prisma documentation.

Implementation: We supported passing DatabaseConfig.shadowDatabaseUrl in the Keystone config object.

Relevant Links:

Follow-up From:

@changeset-bot
Copy link

changeset-bot bot commented Mar 13, 2022

🦋 Changeset detected

Latest commit: d906a85

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@keystone-6/core Minor
@keystone-6/auth Major
@keystone-6/cloudinary Major
@keystone-6/fields-document Major
@keystone-6/session-store-redis Major
@keystone-6/example-auth Patch
@keystone-6/examples-app-basic Patch
@keystone-6/example-ecommerce Patch
@keystone-6/example-graphql-api-endpoint Patch
@keystone-6/example-roles Patch
@keystone-6/example-testing Patch
@keystone-6/example-with-auth Patch
@keystone-6/sandbox Patch
@keystone-6/website Patch
@keystone-6/example-document-field Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Mar 13, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/keystonejs/keystone-next-docs/9v27Gr41L19qEPYucNwfuLy3RR1t
✅ Preview: https://keystone-next-docs-git-fork-chelkyl-support-p-b08035-keystonejs.vercel.app

@vercel vercel bot temporarily deployed to Preview March 13, 2022 08:34 Inactive
@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 13, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d906a85:

Sandbox Source
@keystone-6/sandbox Configuration

@vercel vercel bot temporarily deployed to Preview March 13, 2022 08:38 Inactive
@vercel vercel bot temporarily deployed to Preview March 13, 2022 08:49 Inactive
@vercel vercel bot temporarily deployed to Preview March 16, 2022 02:53 Inactive
@vercel vercel bot temporarily deployed to Preview March 17, 2022 05:03 Inactive
@chelkyl chelkyl force-pushed the support-prisma-shadow-database-url branch from cb7b5bc to 1288906 Compare March 19, 2022 04:38
@vercel vercel bot temporarily deployed to Preview March 19, 2022 05:01 Inactive
@vercel vercel bot temporarily deployed to Preview April 2, 2022 03:38 Inactive
@vercel
Copy link

vercel bot commented Apr 26, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
keystone-next-docs ✅ Ready (Inspect) Visit Preview Jun 23, 2022 at 3:54AM (UTC)

@vercel vercel bot temporarily deployed to Preview April 26, 2022 01:44 Inactive
@jlarmstrongiv
Copy link

@dcousens thanks for running the pipeline!

@bladey we’ve double checked the GraphQL schema updates #6982 (comment)

@molomby we implemented your suggestions from #6982 (comment)

Thank you all for your help! Let me know if there’s anything else needed to move this PR along.

@dcousens dcousens force-pushed the main branch 2 times, most recently from e6c203a to 25de5b5 Compare May 11, 2022 02:21
@vercel vercel bot temporarily deployed to Preview May 19, 2022 02:36 Inactive
@jlarmstrongiv
Copy link

@dcousens any updates? 🤞

@dcousens dcousens force-pushed the support-prisma-shadow-database-url branch from c68c094 to 6b45119 Compare June 1, 2022 01:36
@vercel vercel bot temporarily deployed to Preview June 1, 2022 01:45 Inactive
@dcousens
Copy link
Member

dcousens commented Jun 6, 2022

Hi @jlarmstrongiv, we haven't forgotten this, the only remaining block is to verify the desired behaviour around the schema.prisma changes.

We want to see if we can always provide the shadow database URL, and hoping that, it being blank reverts to the default behaviour.

@jlarmstrongiv
Copy link

Thanks for the update @dcousens much appreciated 👍

Yes, we implemented it similar to prisma flags

@borisno2
Copy link
Member

borisno2 commented Jun 15, 2022

Hi @jlarmstrongiv Thanks for your reply, we are wanting to avoid the prisma.schema file changing depending on environment variables.

If you were to alway print url = env("DATABASE_URL") shadowDatabaseUrl = env("SHADOW_DATABASE_URL") in the prisma schema but process.env.SHADOW_DATABASE_URL was blank does it just revert back to default behaviour? I assume due to prisma/prisma-engines#1672 if we also print shadowDatabaseUrl = env("SHADOW_DATABASE_URL") in the prisma.schema and the env is blank prisma will still be happy.

Let me know if you have any questions.

@borisno2 borisno2 self-assigned this Jun 15, 2022
@jlarmstrongiv
Copy link

@borisno2 Thank you for following up! Oh I see, theoretically yes.

Back in February, the prisma/prisma-engines#1672 was recently merged and KeystoneJS was depending on an older version of prisma, so that was not possible at the time.

Now, with KeystoneJS depending on prisma@3.14.0 (released a month ago), including shadowDatabaseUrl = env("SHADOW_DATABASE_URL") in every schema should work.

@chelkyl chelkyl force-pushed the support-prisma-shadow-database-url branch from 6b45119 to 593effc Compare June 20, 2022 00:48
@vercel vercel bot temporarily deployed to Preview June 20, 2022 00:50 Inactive
Co-authored-by: John Armstrong <jlarmstrongiv@users.noreply.github.com>
chelkyl and others added 2 commits June 19, 2022 20:38
Co-authored-by: John Armstrong <jlarmstrongiv@users.noreply.github.com>
Co-authored-by: John Armstrong <jlarmstrongiv@users.noreply.github.com>
@chelkyl chelkyl force-pushed the support-prisma-shadow-database-url branch from 593effc to c7611e0 Compare June 20, 2022 01:39
@vercel vercel bot temporarily deployed to Preview June 20, 2022 01:43 Inactive
@jlarmstrongiv
Copy link

@borisno2 we updated the PR with your suggestions 🚀 would you run the the workflow?

Co-authored-by: John Armstrong <jlarmstrongiv@users.noreply.github.com>
@jlarmstrongiv
Copy link

Interesting! We now set it to an empty string instead, which should work https://github.com/prisma/prisma-engines/pull/1672/files#diff-c1428df746767db7244ee782e01a8c5cd941e55218ee25ace07da1eece5907e7R169

Would you re-run the workflow @borisno2 ?

@vercel vercel bot temporarily deployed to Preview June 20, 2022 02:51 Inactive
@jlarmstrongiv
Copy link

jlarmstrongiv commented Jun 20, 2022

@borisno2 fixed some hard-coded schema tests, let’s try again 🚀 another workflow re-run?

@vercel vercel bot temporarily deployed to Preview June 20, 2022 03:26 Inactive
@chelkyl chelkyl force-pushed the support-prisma-shadow-database-url branch from 3f23f25 to 25d7064 Compare June 20, 2022 22:33
@vercel vercel bot temporarily deployed to Preview June 20, 2022 22:54 Inactive
specifically alignment via spaces
@chelkyl chelkyl force-pushed the support-prisma-shadow-database-url branch from 25d7064 to 7802a08 Compare June 20, 2022 23:18
@vercel vercel bot temporarily deployed to Preview June 20, 2022 23:21 Inactive
@borisno2 borisno2 requested a review from a team June 21, 2022 01:15
@vercel vercel bot temporarily deployed to Preview June 23, 2022 03:44 Inactive
@vercel vercel bot temporarily deployed to Preview June 23, 2022 03:54 Inactive
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.

6 participants