Apply schema changes to CRUD UI workspace data#50
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a18d6f6ca3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (var relationship : source.relationships()) { | ||
| if (relationship.fromEntityName().equals(mapping.sourceFromEntity()) | ||
| && relationship.name().equals(mapping.sourceName())) { |
There was a problem hiding this comment.
Preserve mappings to reverse relationship aliases
When the user maps a target relationship to a reverse relationship name exposed by the workspace metadata, such as todo|task-of after changing the relationship direction, this check never recognizes it because source.relationships() only contains the forward schema definitions. The manual mapping is then ignored and the migration drops those existing edges even though the UI offered the reverse relationship as a selectable source; consider matching relationship.reverse() with swapped endpoints too.
Useful? React with 👍 / 👎.
Summary
Closes #48.
Adds a safe Schema Edit apply-to-workspace flow for the CRUD UI. The flow validates a draft schema, previews migration impact, allows explicit mapping of renamed entities, fields, and relationships, and applies the migrated workspace only after confirmation.
What Changed
/ui/schema/upgrade/previewand/ui/schema/upgrade/applyroutes.WorkspaceSchemaUpgradeServicefor draft validation, migration preview, row and relationship edge migration, type coercion reporting, fallback/default value assignment reporting, stale workspace version checks, and atomic workspace replacement.Refresh Preview,Confirm Apply, andCancel.Validation
node --check thingifier-crud-ui\src\main\resources\public\assets\app.jsmvn -pl thingifier-crud-ui "-Dtest=CrudUiControllerTest" testmvn -pl thingifier-crud-ui "-Dtest=WorkspaceSchemaUpgradeServiceTest,CrudUiControllerTest" testmvn -pl thingifier-crud-ui -am testmvn -pl thingifier-crud-ui -DskipTests checkstyle:check@project-fqn-checkmvn spotless:checkmvn -pl thingifier-crud-ui -am -DskipTests package