sqlx
sqlx copied to clipboard
Warnings for .down.sql checksums
It appears using down migrations and then running sqlx migrate info
results in various unhappy logs that complain a checksum with a matching version is installed, but with the wrong checksum. If I understand correctly this is because up and down migrations share a version and the checksum only matches the up migration.
Does that sound right? and if yes, should we change it to get rid of the "seemingly something is wrong, but not really".
I imagine options are:
-
ignore down migrations, they're not being checksummed and haven't actually modified the DB as they haven't run, so don't check if they match either.
-
add down migrations to the migrations table. (might result in odd behavior as they haven't actually been run)
-
use a whole separate table, or column to identify down migrations, with their checksums, allowing to check they haven't been changed whilst still easily allowing to update them considering they haven't been run or whatever other behavior they need.
-
sounds most sensible to me.
A screenshot to illustrate what the warnings look like. Do note some warnings might look valid because I tried to fix the checksums by hand by updating the checksum misunderstanding that the warning was valid for some but invalid for others.
I'd like to work on this but not sure where to get started, how about the simplest, a PR for 1. that makes it easiest to later change our minds and alleviates the direct problem without doing anything more.
That is, if a migration ends in .down.sql
it is not considered for checksum comparison.
How does that sound?