Skip to content

Data Migration (Historic) ​

Status: complete. This document describes the one-time data migration from Java IMS to the CAP backend during the 2026 cutover. Kept for historical reference.

Source: extracted from project README, 2026-05-25.

Migration scripts in scripts/ support parallel operation during cutover from the Java IMS. Three migration paths cover the matrix of source-system access (REST API vs. direct HANA):

Scriptnpm aliasSource → TargetPurpose
migrate-reference-data.js exportnpm run migrate:referenceIMS REST → JSON fileExport tutorials, missions, groups, events, tags, accomplishments, prizes
migrate-reference-data.js importnpm run migrate:referenceJSON file → CAPImport reference data into CAP HDI (idempotent on legacyId)
migrate-reference-data.js populate-slugs—.migration-data/slug-mapping.json → CAPBackfill Missions.slug + CompletionPaths.slug after import (87 missions, 66 groups)
migrate-user-progress.js exportnpm run migrate:usersIMS REST → JSON filePaged + resumable export of users + task records
migrate-user-progress.js importnpm run migrate:usersJSON file → CAPIdempotent re-import (uses uuid/legacyId for upsert)
migrate-from-hana.jsnpm run migrate:hanaIMS HANA → CAP HANADirect HDI-to-HDI migration; bypasses the REST API for bulk + cross-instance moves
compare-systems.jsnpm run compareIMS vs. CAP RESTEndpoint-by-endpoint diff for cutover sign-off

migrate-from-hana.js source-credentials resolution (first match wins) ​

  1. IMS_HANA_CREDENTIALS env var (full JSON: host, port, user, password, schema)
  2. IMS_DB_URL + IMS_DB_USERNAME + IMS_DB_PASSWORD env vars (the shape returned by cf env imsdev)
  3. --source-instance=<name> --source-key=<name> (resolved via cf service-key)

Useful flags: --discover (list source-schema tables, no writes), --dry-run, --source-only, --entity=tutorials,users,….

Environment ​

IMS_BASE_URL, CAP_BASE_URL, IMS_AUTH_TOKEN for the REST-based scripts; HANA env vars (above) for migrate-from-hana.js. Java IMS uses the IMSDBUSER schema (not the HDI schema) — see cf env imsdev for prod creds.

Export artifacts land in .migration-data/ (gitignored). The same directory holds slug-mapping.json, which is the canonical slug source for fresh DB deploys — scripts/setup-dev-data.cjs consumes it via npx cds bind --exec to assign slugs to records that lack them. Per CLAUDE.md, the legacyId match is best-effort; a slug just needs to exist for /build/catalog to surface text slugs instead of numeric IDs.