fix: store updated db version instead of final target version to prevent potential issues with an update which fails half way a serie of updates #3192
+13
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In the
InstallRepositorythere is a list of updates defined:leantime/app/Domain/Install/Repositories/Install.php
Lines 41 to 76 in 6316354
During database schema updates this list is used to update the database schema in steps.
After each update the
db-versionis updated in the database, but it is directly updated to the target version in stead of the just executed updateVersion.If one of the updates after this fails, then a check for version updates will indicate that is already all installed, while that actually is not the case yet.
Fix
Update
db-versionto the just updated version.Each update will update to the new updated version, if a next update fails, next time it will try that update again.
NOTE:
I faced that the same during the development of my own plugin. I created a fix for that in my plugin and also wanted to propose a fix for the main project.