fix: update total statements in the migration when it is being executed#2456
fix: update total statements in the migration when it is being executed#2456ruslic19 wants to merge 1 commit intoariga:masterfrom
Conversation
The reason for this is that users are required to edit existing migration files to resolve partial failure issues. Without keeping total in sync, such migration would be considered still pending, because total != applied. Issue: ariga#2455
|
Thanks for opening this PR, @ruslic19. It requires additional work because in cases like the one mentioned in the issue, the "partial hashes" (stored in the revisions table) need to be updated as well. I suggest using |
|
Hi again, @a8m, I just had on my opinion more serious issue than previous one. My partially failed migration was marked as successful even though it didn't successfully end. The reason is still the same. Steps to reproduce:
So, because of this I decided to take a look on what you said and it seems to me that partial hashes are actually getting updated already, take a look here in the code. Also checked it manually by inspecting As I understand, this should be good enough to only add new partial hashes, because previous query should not be edited anyway, because partially failed migration will anyway skip successful queries during next execution, so only queries added after successful one matter. I can be wrong here of course, so, sorry for bothering in such case. |
The reason for this is that users are required to edit existing migration files to resolve partial failure issues. Without keeping total in sync, such migration would be considered still pending, because total != applied.
This fix was NOT tested in all possible use cases, but only in the one described in the linked issue and it resolves it.
Issue: #2455