Skip to content

Harden Repairsteps and migration#4214

Merged
dartcafe merged 13 commits into
mainfrom
test/migration-safety
Aug 16, 2025
Merged

Harden Repairsteps and migration#4214
dartcafe merged 13 commits into
mainfrom
test/migration-safety

Conversation

@dartcafe

@dartcafe dartcafe commented Aug 15, 2025

Copy link
Copy Markdown
Collaborator

First I was trying to force reloading of changed types and to ensure that outdated classes are not used anymore. The Idea was to define an alias for the Classes used while updating

Long story short; This ended in a crucial refactoring with a lot of side effects and a massive grown complexity.

Backt to the long story:
The background is, polls uses another declarative way in migrating and creating database structures. The recommended way is to add a new migration, once the database has to be touched. Over the years this would have become unmaintainable IMHO.

Polls uses a declarative way to define tables, their relations and indices and constraints. The value is a centralized definition of the database and the possibilty to have commands like polls:db:rebuild without massive code duplication, which help to create a consistent database schema, nevertheless what has changed inside the database, if you removed indices, deleted a table, and so on. ... and more convenient, if the database has to be changed, sind only properties have to be changed or added to the table definition.

The downside is an effect, that while updating, Nextcloud can't load changed classes, because when the code is replaced during the update process, the old class may be probably already loaded - with it's old signature. This causes Exceptions, if the Table and Index definitions or Manager methods got changed.

Also Polls makes heavy usage of the repair steps, to ensure some checks and fixes are executed on every install|update|enabling.

So the decision was made to change this completely.

What is the desired Value:

  • pre- and post-migration actions are now only executed, if a new migration exists, speeding up code-only updates
  • Changed classes (tableSchema and Managers) should always be loaded in their current incarnation as they get versioned and appear as new class
  • Still identical actions for migrations and occ commands
  • Fixing the following issues:

fixes #4206
fixes #4213
fixes #4210
fixes #4206 (to be honest, was fixed in another PR)

If anyone followed until here: Hello 👋

After simulating millions of installs, updates, dis- and enabling, destroying and repairing the db , I would like to rely on some guys who can give feedback, if any issues still exist.

Signed-off-by: dartcafe <github@dartcafe.de>
Signed-off-by: dartcafe <github@dartcafe.de>
Signed-off-by: dartcafe <github@dartcafe.de>
Signed-off-by: dartcafe <github@dartcafe.de>
Signed-off-by: dartcafe <github@dartcafe.de>
Signed-off-by: dartcafe <github@dartcafe.de>
Signed-off-by: dartcafe <github@dartcafe.de>
@dartcafe dartcafe added this to the 8.3 milestone Aug 16, 2025
dependabot Bot and others added 6 commits August 16, 2025 23:01
Bumps [shivammathur/setup-php](https://github.com/shivammathur/setup-php) from 2.35.2 to 2.35.3.
- [Release notes](https://github.com/shivammathur/setup-php/releases)
- [Commits](shivammathur/setup-php@ccf2c62...2052987)

Signed-off-by: dartcafe <github@dartcafe.de>

---
updated-dependencies:
- dependency-name: shivammathur/setup-php
  dependency-version: 2.35.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
Signed-off-by: dartcafe <github@dartcafe.de>
Signed-off-by: dartcafe <github@dartcafe.de>
Signed-off-by: dartcafe <github@dartcafe.de>
Signed-off-by: dartcafe <github@dartcafe.de>
@dartcafe dartcafe merged commit eb4a57c into main Aug 16, 2025
47 checks passed
@dartcafe dartcafe deleted the test/migration-safety branch August 16, 2025 22:43
@nursoda

nursoda commented Aug 18, 2025

Copy link
Copy Markdown

Looks good. What I did to test because I had issue #4210 when I updated to 8.3.0_beta.1 in my test instance:

I disabled and removed polls 8.3.0_beta.1. In the database, I deleted all oc_polls_* tables and all polls lines in oc_migrations. I manually downloaded polls 8.2.2 zip from github and extracted it to the apps directory, enabled it. That took a while. I then updated to 8.3.0_beta.3 via occ upgrade. That was very quick. No errors here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Polls upgrade issue: Not null violation 8.3.0-beta.1: Type error in TableManager.php Polls can't be accessed by the creator of poll

3 participants