Skip to content

[legacy-framework] Fix blitz db reset for Prisma >=2.0.0-beta.8#716

Merged
flybayer merged 2 commits intoblitz-js:canaryfrom
SigurdMW:fix-db-raw
Jun 27, 2020
Merged

[legacy-framework] Fix blitz db reset for Prisma >=2.0.0-beta.8#716
flybayer merged 2 commits intoblitz-js:canaryfrom
SigurdMW:fix-db-raw

Conversation

@SigurdMW
Copy link

Closes: blitz-js/legacy-framework#689

What are the changes and their implications?

Changed db.raw to db.rawQuery that was needed due to Prisma 2.0

Checklist

  • Tests added for changes
  • PR submitted to blitzjs.com for any user facing changes

@SigurdMW SigurdMW requested a review from aem as a code owner June 25, 2020 13:15
@SigurdMW
Copy link
Author

So I noted that the types for db in the method resetPostgres is set to any, should I try to fix it so that it's at least typed to the PrismaClient type even though that's also any at this point? Could be that the type changes in the future

Copy link
Member

@flybayer flybayer left a comment

Choose a reason for hiding this comment

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

Thank you @SigurdMW!

Couple things, as this doesn't work as is:

  1. .rawQuery needs renamed to .queryRaw
  2. All the statements without SELECT should use .executeRaw

Here's the prisma docs on this change

The original issue wasn't clear on this, so sorry about that.

Then after making those changes, test it to make sure it actually works on a real database :)

@SigurdMW
Copy link
Author

@flybayer does it look better now? Did run successfully when symlinking and testing locally 👍

@flybayer
Copy link
Member

Beautiful!! Thank you so much :)

@all-contributors add @SigurdMW for code

@allcontributors
Copy link

@flybayer

I've put up a pull request to add @SigurdMW! 🎉

@flybayer flybayer changed the title updated db.raw to db.query Fix blitz db reset for Prisma >=2.0.0-beta.8 Jun 27, 2020
@flybayer flybayer merged commit 5294166 into blitz-js:canary Jun 27, 2020
@johncantrell97
Copy link

fyi -- this means it's now broken if you try to use older versions of prisma :)

@itsdillon itsdillon changed the title Fix blitz db reset for Prisma >=2.0.0-beta.8 [legacy-framework] Fix blitz db reset for Prisma >=2.0.0-beta.8 Jul 7, 2022
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.

blitz db reset broken in Prisma 2 (need to change raw to rawQuery)

4 participants