-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
On wasp db migrate-dev, if TS compilation failed, we don't do actual migration #2202
Comments
The problemHere's what happens with
Proposed solutions@Martinsos identified two possible approaches:
Tolerating TypeScript errorsI decided against this approach because:
Migrating before generating the clientThis is the correct thing to do since it's natural to generate the database client after taking care of the database. By default, Prisma generates the client after each migration. We turned this off in #962 because, at the time, we needed two different clients (source). Since we no longer need two clients, my first thought was to turn the automatic client generation back on and stop generating the client manually. Unfortunately, we still want to generate the client during We could add a flag that tells The proper solution (IMO)It's best that each command only runs the compilation steps it needs. Wasp goes through these steps before running each database command (as part of
The Therefore, to make this solution possible, we'd have to modularize the |
Thanks for the detailed analysis @sodic ! That makes sense to me, but quick idea: what if we ran Ok, we will be able to figure out the details when we get into it, but it makes sense to me general. I wonder if we are loosing anything by not building user code / Wasp SDK code when doing migration, are we twarthing some expectations from user, but I guess not. |
Here is related discord convo, this caused quite some confusion: https://discord.com/channels/686873244791210014/1263910702117163119/1263910702117163119 .
What happens is that if prisma schema is changed in such way that the new Prisma SDK is causing TS errors in the project (which is likely), we don't do actual migration.
Ok, so we probably first do prisma generate , then try to compile the Typescript project, and only then prisma migrate. I wonder if we should change this: we could run prisma migrate even if TS compilation fails. That sounds like it might be somewhat more correct / expected, and is in spirit with TS compilation philosophy. Seems that is what you also expected in this situation.
Even if not, we should make it clear in the error message what happened.
But I would suggest we revisit the
wasp db migrate-dev
and make sure we do perform actual migration even if TS compilation fails.The text was updated successfully, but these errors were encountered: