Skip to content

fix(migration): keep data entered on 1.0.12 through the upgrade - #241

Merged
skjnldsv merged 5 commits into
mainfrom
fix/upgrade-keeps-data
Nov 17, 2026
Merged

skjnldsv merged 5 commits into
mainfrom
fix/upgrade-keeps-data

Conversation

@skjnldsv

@skjnldsv skjnldsv commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

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 upgrade or 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-by trailer.

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>
@skjnldsv skjnldsv added 3. to review Waiting for reviews bug Something isn't working AI assisted This PR contains AI-assisted commits labels Nov 17, 2026
@skjnldsv skjnldsv self-assigned this Nov 17, 2026
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>
@skjnldsv
skjnldsv merged commit 86e9c1b into main Nov 17, 2026
65 checks passed
@skjnldsv
skjnldsv deleted the fix/upgrade-keeps-data branch November 17, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted This PR contains AI-assisted commits bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant