What are the changes?
Billing entity on wallet transactions
With multi-billing-entity billing, a customer’s subscriptions, wallets and invoices are no longer tied to a single billing entity, and different wallets of the same customer can belong to different entities. To keep accounting traceable, wallet transactions now store their ownbilling_entity_id, stamped at creation time. A transaction therefore always reports the entity it was actually created under, even if the wallet is later moved to another entity. Only transactions created after the move carry the new entity.
As a result, existing wallet transactions must be backfilled with the billing entity of their customer. This is done through a rake task that must be triggered manually.
Why are we doing this?
Previously, the billing entity of a wallet transaction could only be inferred from its customer, which had exactly one entity. Now that a wallet can be moved between entities, inferring the entity would retroactively rewrite the history of past transactions. Storing the entity on each transaction keeps historical records accurate and entity-level accounting reliable.What should self-hosted users do?
Cloud users do not need to follow these instructions as the migration will be performed by the Lago Team.
Migration Steps
1. Install Lago v1.52.0
Install the new version. Schema migrations (new tables and columns) will run automatically on startup.2. Backfill wallet transactions
Open a shell on your API server and run the migration task:The backfill task is safe to run multiple times. It only targets wallet transactions without a billing entity, so already-migrated records are left untouched.