Repository navigation
fix(contexts): map each node of an imported application to its own table or view - #3200
Open
rubenvdlinde wants to merge 1 commit into
Open
rubenvdlinde wants to merge 1 commit into
rubenvdlinde wants to merge 1 commit into
Conversation
rubenvdlinde
force-pushed
the
fix/noid/import-context-node-mapping
branch
from
November 3, 2026 14:51
6d3a321 to
4603c99
Compare
…ble or view Moving a user's data imported an application once for every table it held, and pointed every node of each copy at that one table, views included. The migrator now imports the tables and views first and then each application once, mapping every node to the table or view it was imported as. Page contents and widget sources follow the node they showed, and menu items that open a table or a view keep theirs; a node that was not imported is left out. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
rubenvdlinde
force-pushed
the
feat/noid/app-menu-export-import
branch
from
November 4, 2026 12:35
2471ff4 to
6368c26
Compare
rubenvdlinde
force-pushed
the
fix/noid/import-context-node-mapping
branch
from
November 4, 2026 12:35
4603c99 to
88e3e69
Compare
rubenvdlinde
marked this pull request as ready for review
November 6, 2026 08:24
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.
Part of #3099, on top of #3138 (menu export and import). When a user's data is moved to another instance (
TablesMigrator), an application now comes along once, with every table and view in it pointing at the table or view it was imported as.Size: 364 lines: 133 code and 231 tests.
What was wrong
TablesMigrator::import()calledContextService::importContext()for every application once per imported table, before the views were imported.importContext()then pointed every node of the application at that one table (setNodeId($table->getId())), whatever the node was. An application with two tables and a view therefore came out as two applications, each with three nodes on the same table, the view node included. Measured with that application on an earlier version of this stack, which had the same import:What changes
importViews()now returns the view ids), and then imports each application once.importContext(array $context, string $ownerId, array $tableIds, array $viewIds)maps every node to its own imported table or view. A node whose table or view didn't come along is left out, and so are the page contents and widget sources that showed it. An application none of whose nodes came along is not imported, as before.How it was tested
On Nextcloud 34 with PostgreSQL:
ContextPagesRoundTripTest: a database round trip of an application with two tables, a view and a widget on each. Every node, start page content and widget source lands on its own table or view.MenuServiceTest: a menu with an item on a table and an item on a view is exported and imported with new node ids. Both items open the new relation of their node, and an item on a view that didn't come along is skipped. With views left unmapped, this test, the round trip above and theContextServiceTestone below fail.ContextServiceTest: nodes, page contents and widget sources of tables, a view and a node that didn't come along, the owner, and an application without imported nodes.TablesMigratorTest: an application with two tables and a view is imported once, with the ids of both tables and the view.composer cs:check, psalm and rector, all cleanplaywright/e2e/context.spec.tson PostgreSQL with Nextcloud 34: 7 passed. Its first test, "Update and add resources", also passed on SQLite with Nextcloud 35The user migration itself (
occ user:export/user:import) was not run: theuser_migrationapp is not on the test instance.🖼️ Screenshots
No UI changes.
🏁 Checklist
/backport to stableX.X🤖 AI (if applicable)