Repository navigation
fix(migration): keep data entered on 1.0.12 through the upgrade - #241
Merged
Merged
Conversation
The contract step deleted the working weekdays people had set for themselves, so an upgrade from 1.0.12 lost them. They now stay until a new step turns each valid value into a contract period from January 1 of the current year, with a history entry that names the person's own setting as its source, and then deletes the setting for everybody. The table rename copied rows without a transaction and skipped a table whose copy already had rows, so a copy that failed half way was never finished and the next step dropped the old table anyway. Each table is now copied in one transaction, and the old table is only dropped when its copy holds at least as many rows; otherwise the upgrade stops with the old table intact. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
HR used Absence 1.0.12 before the betas. A new workflow installs that version on SQLite, MySQL and PostgreSQL, enters invented data the way 1.0.12 stored it (requests with half days, entitlements and their history, comments on a confidential absence, an attachment file, own weekdays, regions and settings), upgrades to the pull request's code with `occ upgrade` and compares what is stored before and after. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
The upgrade jobs failed before reaching the app: on a stable server branch `occ upgrade` stops while the always-enabled viewer app has no files, and the server checkout does not bring it. The workflow adds it. The check now also starts from 1.0.0-beta.1, moves to the new code by removing and enabling the app as well as with `occ upgrade`, and bumps the version when the code still carries the one of the last release, since Nextcloud runs no migration without a new version. It compares what is stored for any instance instead of a fixed list of people, asks the app for the balances before and after, and checks that every migration of the code ran. Assisted-by: ClaudeCode:claude-fable-5-2 Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
Oracle stores an empty value as NULL, and the server's typed read of a setting for all users fails on it. One person with an empty weekdays setting would have stopped the upgrade there. The migration now reads the settings with its own query. The upgrade check runs on Oracle too. Assisted-by: ClaudeCode:claude-fable-5-2 Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
…alues Oracle refuses to change the type of a column that has values, so an upgrade from 1.0.12 stopped at this step with ORA-01439. On Oracle the days are now written as text to a new column that replaces the old one, and the indexes Oracle drops with the old column are added again. Assisted-by: ClaudeCode:claude-fable-5-2 Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
HR runs Absence 1.0.12. Upgrading it to the betas deleted each person's own working weekdays (migration 1010), and the entitlement history could lose rows if the upgrade failed halfway through the table copy (1013) and was run again before the drop (1014).
1010 now keeps the weekdays, and a new 1018 turns each valid value into a contract from January 1 of the current year. 1013 copies each table in one transaction, and 1014 stops the upgrade instead of dropping a table whose copy is incomplete.
A new workflow installs 1.0.12 or 1.0.0-beta.1 on SQLite, MySQL, PostgreSQL and Oracle, fills it with invented data, moves to this branch with
occ upgradeor by removing and enabling the app, and checks that every request, entitlement, history entry, comment, attachment, leave type, setting and balance is the same before and after.👾 This pull request was assisted by Claude Code, commits carry an
Assisted-bytrailer.