organization_billing_seat_events API Postgres table
Audit ledger for billable-seat reconciliation.
Declared in packages/api-shared/src/schema/organizationBillingSeats.ts
Description
Events are intentionally provider-neutral. They capture the seat movement and current licensed count that a Stripe or RevenueCat integration can use to update subscription quantity or create a prorated charge for the remaining billing period.
Columns
iduuid- primary key
- not null
- default gen_random_uuid()
Event id.
organization_iduuid- not null
Organization whose seats changed.
event_typetext- not null
seat_assignedorseat_releasedfor one member's seat;licensed_seat_count_initialized(from zero),licensed_seat_count_increased, orlicensed_seat_count_decreasedfor a change in licensed capacity;licensed_seat_count_resetwhen a trial expiry or revoked subscription drops it to zero.user_iduuid- nullable
Member whose seat was assigned or released; null for licensed capacity events.
quantity_deltainteger- not null
Change in licensed seats the event made; 0 for seat assignments and releases.
licensed_seat_countinteger- not null
Licensed seats after the event.
active_seat_countinteger- not null
Members reachable from the Members group when the event was recorded; 0 when a trial expiry, revocation, or subscription move released every seat.
billing_period_starts_attimestamp- nullable
The paid period the event falls in (a trial expiry records the trial's span); null when there is none.
billing_period_ends_attimestamp- nullable
The paid period the event falls in (a trial expiry records the trial's span); null when there is none.
source_typetext- not null
What caused the event, in the same form as a seat assignment's source.
source_idtext- not null
What caused the event, in the same form as a seat assignment's source.
source_principal_typetext- nullable
The principal (
groupororganization) whose signed policy change or provisioning caused the event; null for other sources.source_principal_iduuid- nullable
The principal (
groupororganization) whose signed policy change or provisioning caused the event; null for other sources.created_attimestamp- not null
- default now()
When the event was recorded.
Indexes
organization_billing_seat_events_org_created_idx(organization_id, created_at)organization_billing_seat_events_org_source_idx(organization_id, source_type, source_id)