-- @database: main
--
-- Freeze the legacy XP journal now that the value ledger has taken over.
--
-- `user_transaction` was the pre-ledger append-only XP audit table (never
-- versioned — created by hand). Since ExperienceService now writes to
-- `ledger_entry` + `user_balance` via LedgerService, nothing appends to it any
-- more. We rename it rather than drop it so the historical XP rows stay
-- consultable as a read-only archive.
--
-- ORDER OF OPERATIONS (important): run this ONLY AFTER the new application code
-- (LedgerService bascule) is deployed. While the old code is live it still
-- INSERTs here, and renaming the table out from under it would break awards.
--
-- Opening balances are seeded separately by `bin/ledger-opening-balances.php`
-- (UUIDv7 ids are generated app-side, not in SQL). Run that script AFTER this
-- rename.

RENAME TABLE `user_transaction` TO `user_transaction_legacy`;
