Skip to content

fix(import): import preview rows use source_row, row_number is reserved on MariaDB - #5879

Merged
rubenvdlinde merged 4 commits into
developmentfrom
fix/import-preview-row-column
Nov 6, 2026
Merged

rubenvdlinde merged 4 commits into
developmentfrom
fix/import-preview-row-column

Conversation

@rubenvdlinde

@rubenvdlinde rubenvdlinde commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

A fresh occ app:enable openregister fails on MariaDB 11.4 with error 1064 at row_number INT UNSIGNED. Doctrine only quotes words on its keyword list, and that list does not hold ROW_NUMBER for MariaDB. The failed enable leaves 106 tables and no rows in oc_migrations.

The change

  • Version1Date20260915050000 creates source_row. A fresh install runs Nextcloud's schema-only path, which skips pre and post steps, so this edit is what fixes it.
  • Version1Date20261106120000 is new. On an install that still holds row_number it runs one quoted ALTER TABLE ... RENAME COLUMN. Rows and idx_or_improw_unique stay. It does nothing when the column is already gone.
  • ImportPreviewRow::$rowNumber becomes $sourceRow, and the mapper sorts on source_row.
  • <version> moves to 2.1.35-unstable.20261106120000. Without that, occ upgrade does not read the new step.

The API does not change: a row is still answered under the key row.

Who is affected

  • main never held the migration, so stable installs are not touched.
  • It shipped in every beta from v2.1.33 (19 Sep) to v2.1.42, and in unstable from 2.1.27. The App Store lists 2.1.42-beta, so it can reach public installs.
  • Installs on PostgreSQL ran it and hold row_number, the local :8080 instance among them. The follow-up renames it on upgrade.
  • Installs on MariaDB 11.4 could not enable the app at all. MySQL 8 is expected to have run it, because Doctrine's MySQL keyword list holds the word; that was not tested.
  • Which hosted installs ran it cannot be read from here.

Verified on real databases

Nextcloud 34, throwaway containers, MariaDB 11.4.13 and PostgreSQL 16. Each case checked the column, the unique index, the oc_migrations row, and a real write and read through the mapper.

Case Result
Old code, fresh enable on MariaDB Fails with 1064, reproduced
Retry on that failed install with this code Enabled, 157 tables, 262 migrations
Fresh enable on MariaDB Enabled
Fresh enable on PostgreSQL Enabled
PostgreSQL install on the old code with 3 rows, then occ upgrade Column renamed, 3 rows kept, index on source_row
MariaDB holding row_number, then occ upgrade Same result

That last MariaDB install was made by restoring the old column by hand, because the old code cannot install there. It stands for an install that ran the migration on an older MariaDB and moved to 11.4.

Not tested: MySQL, because no image is on this machine. Nextcloud 32, 33 and 35 were not run either.

Unit tests: the new migration test, tests/Unit/Db, tests/Unit/Service/Import and the preview controller test under pcov, 3352 tests, 0 failures. Capped mutants on the migration: 5 of 5 killed. phpcs, phpmd, phpstan and psalm clean on touched files. check-migration-version-bump: OK. Gate 119: 0.

Full suite

Full PHPUnit under pcov with --fail-on-risky through heavy.sh, on combined b193646ed (#5879, #5882, #5883 and #5887 on development 47f5021b9): 34640 tests, 1 failure, 34 risky. The failure is inherited: CalculationEvaluatorGoldenTest records a literal tomorrow for dateAdd bad date, so it goes red on any later day, and this tree touches no calculation file. The 34 risky are the 18 inherited plus 16 in ObjectsControllerGeoRoutesGoldenTest, also on development.

Rerun on this head cbc50fe24, MariaDB 11.4.13: development still fails with 1064; retry on that failed install, a fresh enable, and occ upgrade from row_number with 3 rows all pass. PostgreSQL 16 ran on the same migration before that: upgrade from the old code with 3 rows, and a fresh enable.

🤖 Generated with Claude Code

…ed on MariaDB

Enabling the app on MariaDB 11.4 failed with error 1064: Doctrine leaves
row_number unquoted there. Version1Date20260915050000 now creates source_row.
Version1Date20261106080000 renames the column on installs that already hold it,
with one quoted RENAME COLUMN, so their rows and the unique index stay. The
version moves with it, or occ upgrade would not read the new step.

The API is unchanged: rows are still answered under the key row.

Assisted-by: ClaudeCode:claude-opus-5-5
…view-row-column

# Conflicts:
#	appinfo/info.xml
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ db9cb51

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ❌
psalm ❌
phpstan ❌
phpmetrics ✅
eslint ❌
stylelint ✅
build ✅
check-specs ✅
test-l10n ❌
test-l10n-parity ✅
check-schema-l10n ✅
composer ✅ ✅ 165/165
npm ✅ ✅ 640/640
app:check-code ⏭️
info.xml ✅
REUSE ✅
lockfile sync ✅
PHPUnit ❌ 34600/34602 · 18 skipped
Newman ❌ 1628/1630
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development.
Hydra gates ❌

Quality workflow — 2026-11-06 08:55 UTC

Download the full PDF report from the workflow artifacts.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant