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
All data will be lost as migration files have changed #7398
Comments
Did you modify any migration files? Looks like a bug in checksum logic if that is not the case. Also, are you using MySQL natively on window or via docker? MySQL on windows by default lowercase all tables name which might be the cause. Read: #6972 |
Nothing modified, no. MySQL native on windows so yes, it could be case sensitivity being an issue. It's been a pain on numerous other tickets over the past 1.5 years. I suspected this might be the case when reporting. |
I think this is probably due to git rewriting the newline characters when checking out files on windows vs unix. That changes the checksums. There is another issue for that: #7101 Do you think it could be the case here? It could have happened if you used migrate inside and then outside (or vice versa) docker or WSL for example. |
It's possible but I'm the only one who adds migrations and I use the same environment each time. Sometimes I will be able to make it work without the modification error and other times not. I'll try and run some tests to see if that's the case. |
I've just had this reported again with a migration I've added. I've compared the local version with the version in source control and they both have CRLF as the line feeds. With this in mind, I can't see how the line feeds would be causing a problem unless Prisma is doing something with them internally. For info. This migration was created by me. I committed it and pushed it and haven't removed / re-cloned the repo in the meantime so this is the same file Prisma created during the migrate command. |
Related? #7101 |
@tomhoule mentioned the same thing above my post which is why I posted the screenshots showing the downloaded file from source and my local version both have CRLF as the line feeds which makes me think it's not related. I'd be happy for it to be the case though. Also happy to keep testing once a fix for the EOL issue is sorted to see if it happens. |
Could it be something removing/adding trailing newlines at the end of files? |
I have no routines or anything which would modify those files and am not doing so manually either 🤔 |
Hmm, that's mysterious. Could there be an encoding question at play, where parts of your setup is using say utf8, and another utf-16? |
From what I can see, everything is in UTF-8 ... I'd be happy to run a dev build with some advanced logging in if it would help. |
I have a sneaky suspicion that this might be related to swapping branches. i.e
Not 100% sure but I've just added a migration without issue and I know I haven't switched branches since my last migration. When I can commit / push this batch of changes, I'll switch branches and do another test to see if it triggers the error. |
See code for documentation on the how and why. Relevant issues: - prisma/prisma#7398 - prisma/prisma#7101
See code for documentation on the how and why. Relevant issues: - prisma/prisma#7398 - prisma/prisma#7101
See code for documentation on the how and why. Relevant issues: - prisma/prisma#7398 - prisma/prisma#7101
See code for documentation on the how and why. Relevant issues: - prisma/prisma#7398 - prisma/prisma#7101
…2101) * Encapsulate checksum handling into a module in MigrationConnector * Make checksum comparison try matching with lf and crlf line endings See code for documentation on the how and why. Relevant issues: - prisma/prisma#7398 - prisma/prisma#7101
Just to confirm, this is definitely a line ending issue and is related to me switching branches. I've not switched then added a migration until just now and got the same issue. Going through each migration and changing the line ending to LF has resolved it. |
Thanks @webnoob for the confirmation A fix just got released in the dev channel on npm (not recommended for production). If you can try this specific version It will be released next Tuesday in our biweekly release. |
Confirming that 2.29.0 has resolved this issue. One of my colleagues had the issue so I told him to update to .29 to see if it was fixed. It solved it immediately. Nice job guys, thanks. |
Bug description
When creating a new migration, I "randomly" get something like:
How to reproduce
Not sure exactly. It's happening after creating new migrations but not every time. More information on what actually triggers this notification would be helpful in me determining how to reproduce it. How does it determine the files have changed, because the content is the same according to my source control?
Expected behavior
The latest migration I've just added is just adding:
isAdmin Boolean?
to a table. I wouldn't expect ALL my data to need clearning.Prisma information
I don't want to share this publicly.
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: