v2_3_* tables keep updating while you move, so you can run old and new queries side by side and compare them before you switch.
Why move
v2.6 publishes the same objects the API returns, so its numbers match the API. Three v2.3 problems go away:- Balances no longer count old plans.
v2_3_balancesadded up every grant a customer ever had, including ended plans and past cycles, so you had to filter them out.v2_6_balancescontains only what the API counts. - Rollovers are included.
v2_3_balancesleft rollovers out. In v2.6 they are part of the balance and listed inv2_6_rollovers. - Subscriptions keep their real status.
v2_3_subscriptions.statusshowed every non-active plan asscheduled.v2_6_subscriptions.statusis the real status:expired,trialing,pausedand so on.
What changes in your queries
- Table prefix.
v2_3_becomesv2_6_.eventsis unchanged. - Product is now plan. Every
internal_product_idbecomesinternal_plan_id, andinternal_customer_product_idbecomescustomer_plan_id. (events.internal_product_idkeeps its name.) - Keys are named after their table. v2.3’s generic
internal_idbecomesinternal_customer_id,internal_plan_id,customer_plan_idand so on, and references use the same name, so a join readss.internal_plan_id = p.internal_plan_id. - Balances have one row per view. Add
scope = 'customer'to customer-level balance queries. See below. - Drop your balance filters. The active-plan, current-cycle and expiry filters you applied to v2.3 balances are already applied.
- Arrays are JSON text. v2.3 had a few array columns (
plan_ids,product_ids,internal_product_ids). In v2.6 every array is a JSON string; see Querying → JSON columns.
Tables
Renamed keys
Balances now have one row per view
In v2.3, each grant appeared once, under whichever scope it had: customer-level grants on rows with noentity_id, entity-level grants on rows with one. In v2.6 each balance is computed separately for the customer and for every entity, the way the API does it, and an entity’s view also includes the customer-level grants it can use.
So the v2.3 habit of summing every row now over-counts. Read Working with balances for the worked example.
Before and after
A customer’s current balance for one feature, including rollovers. v2.3: filter to active plans and the current cycle, then add unexpired rollovers yourself.Checklist
- Run your v2.3 queries and their v2.6 versions side by side for a few customers and compare.
- Change the table prefix, then rename keys using the table above.
- Replace
internal_product_idandinternal_customer_product_idwithinternal_plan_idandcustomer_plan_id. - In balance queries, delete your active/current-cycle/rollover logic and add a
scopefilter. - Where you filtered
status = 'scheduled'to mean “not active”, use the real statuses. - Parse array columns as JSON.
- Tell us when you’ve moved, so we can retire your v2.3 tables.