Skip to content

Database tables

All keys are UUIDs. Amounts are unsigned big integers in minor units. Morph ids are string(64).

Group billing-migrations-core.

ColumnTypeNotes
iduuid
statusstring(20), default pendingPaymentStatus
typestring(20), default chargePaymentType
initiationstring(20), nullablePaymentInitiation
numberstring(64), nullable, uniqueYour human-facing reference
gatewaystring(50), nullableGateway name; null or free text for manual payments
amountunsigned bigintWhat the customer pays
feeunsigned bigint, nullableGateway commission; null = unknown
currencystring(3)
converted_from_currency, exchange_rate (decimal 18,8), exchange_rate_atnullableConversion facts
external_idstring, nullableGateway reference
payment_urlstring(2048), nullable
payment_url_expires_at, paid_attimestamp, nullable
raw_responsejson, nullableGateway response of charge/refund
metajson, nullableYours
tenant_idstring(100), nullable
payable_type, payable_idstring, string(64)
billable_type, billable_idstring, string(64)
parent_payment_iduuid, nullableRefund → charge (indexed, no FK)
timestamps, deleted_atSoft deletes

Indexes: (tenant_id, status), (status, created_at), (gateway, external_id), payable, billable, parent_payment_id.

Group billing-migrations-core. id, name (gateway, 50), url (2048, or reconcile/refund for synthetic claims), external_id (the dedup key), headers, payload, exception (json), timestamps. Unique (name, external_id).

Group billing-migrations-subscriptions. id, code (unique), name, meta (json), timestamps.

Group billing-migrations-subscriptions.

ColumnTypeNotes
pricing_typestring(20), default flat
gatewaystring(50), nullable
currency, amount
intervalstring(20), nullableInterval; null = one-off
interval_countunsigned int, default 1
trial_daysunsigned int, default 0
trial_ending_notices, period_ending_notices, retry_intervalsjson, nullableOverrides; null = config
grace_accessboolean, nullableOverride; null = config
external_price_id, unit_labelstring, nullableYours
included_unitsdecimal(18,4), nullableQuota
quota_intervalstring(20), nullable
quota_interval_countunsigned int, default 1
is_activeboolean, default true
metajson, nullable
plan_iduuid FK → plans, cascade delete

Index (plan_id, gateway, currency).

Group billing-migrations-subscriptions.

ColumnTypeNotes
statusstring(20), default trialingSubscriptionStatus
gatewaystring(50), nullableStamped by the first payment
qtyunsigned int, default 1Seats
current_usagedecimal(18,4), default 0
external_idstring, nullableNon-null = provider-managed
provider_synced_atdatetime, nullableLast applied provider snapshot
trial_ends_attimestamp, nullable
trial_notices_sent, period_notices_sentjson, nullableNotice markers
current_period_ends_at, quota_period_ends_attimestamp, nullable
cancels_at, pause_ends_attimestamp, nullable
grace_ends_at, next_retry_attimestamp, nullableDunning
recurring_attemptsunsigned int, default 0
tenant_idstring(100), nullable
billable_type, billable_idstring, string(64)
price_iduuid FK → prices, restrict delete (since 0.12.8)

Indexes: billable, (status, current_period_ends_at), (status, pause_ends_at), quota_period_ends_at, (gateway, external_id).

Group billing-migrations-payment-methods. gateway, type (default card), brand, last4, expires_at (datetime — card expiries go past 2038), is_default, tenant_id, billable morph, external_customer_id (191), external_id (191). Unique (gateway, billable_type, billable_id, external_customer_id, external_id) — one physical card may be saved by two billables.

Group billing-migrations-invoices. type, status (default issued), number, series, currency, total, seller, buyer, items (json), extra (json), locale, template, issued_at, due_at, paid_at, payment_id (FK → payments, null on delete), invoice_id, tenant_id, billable morph (nullable). Unique (tenant_id, number) and (type, payment_id).

Group billing-migrations-invoices. series, scope (tenant or ''), year, last. Unique (series, scope, year).