wasp db reset showing help instructions
I am trying to setup a seed function and thus wanted to reset my db.
According to the docs: https://wasp-lang.dev/docs/data-model/backends#running-seed-functions I am supposed to run
wasp db reset
.
Sadly this only triggers the help
call:
Is this a bug or am I being stupid?
I also tested it with a new wasp app. Just set the db: System
to PostgreSQL
and ran wasp db migrate-dev
and wasp db reset
afterwards. Same outcome.
PS: The code example has some minor issues in the createUser
Method:
1. The variable is named prisma
and not prismaClient
2. The password
parameter of the sanitizeAndSerializeProviderData
method is named hashedPassword
Databases | Wasp
Entities, Operations and Automatic CRUD together make a high-level interface for working with your app's data. Still, all that data has to live somewhere, so let's see how Wasp deals with databases.
10 Replies
Ah that is a stupid mistake on our side! Here is issue: https://github.com/wasp-lang/wasp/issues/1787 . I just prioritized it, so it will be part of the next bigger release (probably 0.14).
The stuff under PS: I see p
prisma
as param, but that is ok, right? We can name that parameter as we like? Or am I looking at the wrong part of docs?
2. Ah yes, we should have used hashedPassword
and not just password
there, right?@martinsos Perfect, thank you 🙂 as a workaround i used prisma in my seed function to clean my data 🙂
Yeah you can name the parameter as you like, but on the first line of that function you access it with
prismaClient
which does not match the parameter name prisma
(of type prismaClient
)Ah crap, nice catch! We did a lot of these changes for 0.11 to 0.12 switch and must have missed this one.
@Gwaggli would you be up for creating a PR for these two mistakes? So it should be very easy, you just scroll down to the bottom of the page in the docs and there is "edit this page" link/button, which will take you to Github where you should be able to do edit directly and then create a PR, all from Github UI.
If this is complex or you don't have time, no worries, I can make that PR.
Oh damn, its time i download the discord app so i see stuff like this earlier 😄 Sorry for the delay.
https://github.com/wasp-lang/wasp/pull/1928 Happy to make at least a very tiny contribution ❤️
GitHub
Fix mismatching variable names in backend/seed documentation by sir...
Description
Renamed parameter password to hashedPassword in sanitizeAndSerializeProviderData to match its implementation.
Renamed variable name prismaClient to prisma to match the parameters name.
...
Awesome, thanks for this @Gwaggli :)! I gave you the Contributor role on Discord 🙂
Having the same reset issue, what workaround did you use @Gwaggli ?
@ssor_eth I just added a delete function at the beginning which removed all entities and then (when you define the ids in your seed, also reset the sequences:
And the sequence resetting: (a bit ugly i need to admit - open for suggestions here :D)
Wohooo @Gwaggli, you just became a Waspeteer level 6!
wasp reset
will be back in the very next release, so that should take care of that!Having the same issue, can you describe the steps more in details pls? im a noob
I get RangeError: Maximum call stack size exceeded
when running above code in db seed
Okay nevermind, I was logging to console like "records delted" and that was causing the call stack issue