Skip to content

chore: Add migration table for HANA migration#268

Open
stefanrudi wants to merge 35 commits intomainfrom
chore/migration-table
Open

chore: Add migration table for HANA migration#268
stefanrudi wants to merge 35 commits intomainfrom
chore/migration-table

Conversation

@stefanrudi
Copy link
Collaborator

@stefanrudi stefanrudi commented Mar 19, 2026

Add HANA Migration Support for Change Tracking Plugin v1 to v2

New Feature

✨ Introduces HANA migration infrastructure and tooling to support upgrading the @cap-js/change-tracking plugin from v1 to v2. This includes a stored procedure generator, a CLI tool to restore composition backlinks, and a comprehensive migration guide.

Changes

  • bin/restore-backlinks.js: New CLI script (changelog-restore-backlinks) that compiles the CDS model, detects composition relationships, and generates a SAP_CHANGELOG_RESTORE_BACKLINKS.hdbprocedure file in db/src/ to restore missing parent backlinks for existing change data.

  • lib/hana/procedure.js: New module that generates the HANA stored procedure SQL. The procedure finds orphaned change entries for composition child entities, resolves parent entity keys via FK lookup, creates missing parent composition entries (valueDataType='cds.Composition'), and links child entries back via parent_ID. Handles both v1 migrated (single-key) and v2 composite-key formats.

  • migration-plan.md: New step-by-step migration guide covering the full v1→v2 migration flow:

    • Deploy intermediate schema (v1.2.0)
    • Copy createdAt/createdBy from ChangeLog to Changes via SQL merge
    • Deploy new schema using .hdbmigrationtable with column renames, resizes, and drops
    • Restore composition hierarchy backlinks using the new CLI tool
    • Cleanup of temporary artifacts
  • package.json: Registers changelog-restore-backlinks as a binary entry point and adds bin to the published files list.

  • index-old.cds: Added snapshot of the v1 CDS schema for reference during migration.

  • changelog-v1.csv: Sample v1 data for testing the migration flow.

  • tests/bookshop/db/incidents/schema.cds: Minor test schema adjustments — added ID to status changelog annotation, removed @changelog: false on decimalProp, and removed an inline descr composition of one.

  • 🔄 Regenerate and Update Summary

📬 Subscribe to the Hyperspace PR Bot DL to get the latest announcements and pilot features!

PR Bot Information

Version: 1.18.11 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

  • Summary Prompt: Default Prompt
  • LLM: anthropic--claude-4.6-sonnet
  • Output Template: Default Template
  • Event Trigger: pull_request.opened
  • Correlation ID: f0275630-237d-11f1-88c1-05cf329adb95

@stefanrudi stefanrudi requested a review from a team as a code owner March 19, 2026 10:25
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.

2 participants