blitzjs.com
blitzjs.com copied to clipboard
Update the official tutorial with initial db migration #2621
What do you want and why?
Hi. Following along the official tutorial, I stumbled upon an "error" where the User table would be missing, preventing from signing up.
I figured it out easily: one must run blitz prisma migrate dev
.
Possible implementation(s)
Before the Sign up as a user section, add another section "explaining" the need for data (including a table of users), SQLite as a default, the concept of a migration, the schema.prisma file and more importantly, the migration command.
Additional context
Using latest Blitz version as of 02/08/2021: 0.38.6
Thanks @chikamichi — certainly we can improve the tutorial here.
As for the migration command, you do not need to run that command unless something fails during new app setup. Because we automatically run that command during blitz new
. If this step fails for some reason, this command will be listed in the next steps result of blitz new
. But this could be added as a "troubleshooting" item in the tutorial.
Oh!
I overlooked the "Next steps:" section from the install output. When generating a new app, the Initializing SQLite database step is failing indeed.
More accurately: I followed along the tutorial, abiding by the textbook therefore running only those commands the tutorial is highlighting. Hence I didn't pay too much attention to the actual console output.
I could create a PR addressing that (basically: your message above), with a Info note for instance.
As for the error, how could I find what's going wrong? It fails consistently at creating the SQLite DB when running blitz new
.
Should I open an issue on https://github.com/blitz-js/blitz/issues?
As for the error, how could I find what's going wrong? It fails consistently at creating the SQLite DB when running
blitz new
. Should I open an issue on https://github.com/blitz-js/blitz/issues?
Yeah that would be good. Essentially what we are doing is running during blitz new is running blitz prisma migrate dev --name "Initial migration"