Migrate ticketing data to CoreAPI
The migration scripts copy everything the old ticketing backend (ticketing, ticket-admin, ticket-cms) holds into
the new stack (coreapi, authapi-stg and the new admin spatio): the database, the payment and email settings, and
the uploaded files. Run them before the route cutover, and once more right before it to catch up.
Before you start¶
- Shell access to
ticket-node-1. Run every script there, in~/schema-dump. - The scripts read passwords and keys at run time. Never put them in chat, files or git.
- Never commit
ticket-iac/migration/.
If a script says no such file, you are in the wrong folder. If it says permission denied, run chmod +x <SCRIPT>.
Scripts¶
Every script has a dry mode that prints its plan and changes nothing. Always run dry first and read the plan.
| Goal | Command | Notes |
|---|---|---|
| Plan everything | ./run-all.sh dry |
Changes nothing |
| Apply everything | ./run-all.sh apply |
Asks you to type apply |
| Catch up before cutover | RESET=1 ./run-all.sh dry, then RESET=1 ./run-all.sh apply |
Wipes CoreAPI's ticketing data and reloads it from the old system. Only safe before cutover |
| Data only | ./migrate-johorzoo.sh dry\|apply\|verify |
Stops if the target already has data, unless CLEAN=1 |
| Payment and email settings only | python3 migrate-pos-profiles.py dry\|apply\|verify\|check |
Creates only what is missing; REFRESH=1 overwrites and WIPE=1 deletes existing profiles first: run dry with the same flag first |
| Files only | ./migrate-storage.sh dry\|apply\|verify |
Adds files only; MIRROR=1 also deletes files in CoreAPI's volume that the old volume doesn't have: run dry with the same flag first |
What each part does:
- Data: copies the database
johorZoo.johorzoointocoreapi.johorzoo(24 tables) in one transaction, then compares row counts.verifyrepeats the comparison. - Payment and email settings (profiles): builds the Zoo POS, JohorPay and eTiket Gmail settings from the old
generaltable, encrypts them the way CoreAPI does, and links them to ticket groups.checkcalls CoreAPI's public ticket list and bank list: HTTP 200 with real data proves the settings decrypt and the remote services answer. - Files: copies the uploaded files from the old volume to CoreAPI's volume and compares paths and sizes. The last run matched 1550 of 1550 files.
Rules¶
COREAPI_SECRETS_ENCRYPTION_KEYmust never change once profiles exist: the stored settings can't be decrypted with a new key.- Ticket groups:
1= Taman Botani,2= Zoo Johor,5= KSM. - Never run
RESET=1after CoreAPI has real orders: it would delete them.
Run the migration¶
-
Plan:
Expected: a plan for data, profiles and files, and no changes. 2. Apply, typing
applywhen asked: -
Verify each part:
Expected: row counts match for all 24 tables,
checkreturns HTTP 200 with real ticket and bank data, and every file path and size matches.
Check parity with the old system¶
CoreAPI only has to behave like the old ticketapi: a call that fails on both is acceptable. Send the same calls to
both and note the differences.
| Ticket group | Result (2026-11-24) |
|---|---|
| Zoo Johor (2) | Matches |
| Taman Botani (1) | Empty on both |
| KSM (5) | Fails on both. The bank list differs only for this group |
Open settings (2026-11-24)¶
- KSM (group 5) has no POS or payment profile yet. The KSM server didn't answer from the cluster. Test it from the
node and from the old
ticketingpod first (a network or whitelist fix), then add the profile tomigrate-pos-profiles.py. - Email usage mappings: run
python3 migrate-pos-profiles.py dry, read the plan, thenapply. It maps all five email kinds to the single eTiket Gmail profile, as the old system does. - Taman Botani: the ticket list was empty on one date. Try another date and compare with the old system.
Before cutover, each of these is either filled in or explicitly accepted as is.