Dear Lago Community, πŸ‘‹

We’re writing to inform you about important changes in Lago v1.31.0 that will enhance data consistency. application performances and prepare upcoming features.

What are the changes?

Filling organization_id on every tables of the application

The organization_id column was recently added on every tables related to an organization. Since filling this column is an heavy task, no migration was backfilling it for existing records. It was only populated on newly created records.

As we now need to be able to rely on this column in the application, we have to make sures that every single records has an organization_id value.

Why are we doing this?

These changes are made to increase the performannces of the application and to ease the development on future features.

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.

If you’re using a version below v1.20.0, please first follow the migration steps for v1.20.0, then for v1.25.0, then for v1.28.1, then for v1.29.0. Only after completing those should you proceed to v1.31.0.

Migration Steps

  1. Install the Lago version 1.30.0
  2. Open a shell (bash) on your API server
  3. Run the migration task:
bundle exec rails migrations:fill_organization_id

The task will:

  • Check for all database table to identify the ones that require a migration
  • Enqueue jobs for each tables needing a backfill
  • Loop over all migrating tables until all records are updated

All resources are processed in background jobs, with 1000 records per batch. The task will monitor the values and give you the number of remaing records.

##################################
Starting filling organization_id

#### Checking for resource to fill ####
"- Checking AddOn::AppliedTax: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking AdjustedFee: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking AppliedCoupon: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking AppliedInvoiceCustomSection: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking AppliedUsageThreshold: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking BillableMetricFilter: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking BillingEntity::AppliedTax: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking ChargeFilterValue: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking ChargeFilter: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Charge::AppliedTax: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Charge: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Commitment::AppliedTax: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Commitment: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking CouponTarget: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking CreditNoteItem: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking CreditNote::AppliedTax: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking CreditNote: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Credit: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Metadata::CustomerMetadata: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Customer::AppliedTax: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking DataExportPart: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking DunningCampaignThreshold: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Fee::AppliedTax: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking IdempotencyRecord: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking IntegrationCollectionMappings::BaseCollectionMapping: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking IntegrationCustomers::BaseCustomer: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking IntegrationItem: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking IntegrationMappings::BaseMapping: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking IntegrationResource: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Metadata::InvoiceMetadata: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking InvoiceSubscription: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking PaymentRequest::AppliedInvoice: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Invoice::AppliedTax: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking PaymentProviderCustomers::BaseCustomer: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Payment: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Payment: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Plan::AppliedTax: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking RecurringTransactionRule: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Refund: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Subscription: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking UsageThreshold: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking WalletTransaction: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Wallet: πŸ”Ž"
"  -> Nothing to do βœ…"
"- Checking Webhook: πŸ”Ž"
"  -> Nothing to do βœ…"

#### All good, ready to Upgrade! βœ… ####
  1. Install Lago v1.31.0

Get Involved

If you have any questions or encounter issues during the migration, please reach out to us via the Slack community. Our team is here to help you through this transition.

Thanks for your understanding and continued support.

The Lago Team