Files
member-console/internal/billing/sqlc.yaml
T
cgalo5758 3727ff31d8 Add entitlement set rule change ledger and preview flow
Add an append-only ledger of entitlement set rule changes with per-pool
effect rows, a preview-and-commit rule change flow, and an automatic
drain that settles deferred recomputations. Rules gain a tier reduction
policy, resource keys declare over-limit behavior, and the materializer
now lowers limits when a rule stops applying.
Add entitlement set rule change ledger and preview flow

Add an append-only ledger of entitlement set rule changes with a
preview-and-commit operator flow. Rule writes now go through an enclosed
`core.commit_rule_change` function that files an act row and one
obligation per carrying pool, with a drain workflow settling deferred
recomputations. The preview dry-runs the materializer with a rule
overlay and renders per-pool buckets, reduction-policy disclosures, and
provider over-limit consequences. Materializing transactions take a
shared advisory rendezvous that rule changes hold exclusively, enforced
by a possession assertion. Add History and Entitlement changes surfaces,
a rule-less warning on five product-selection surfaces, and a
`tier_reduction_policy` column that gates FedWiki parking.
2026-09-15 03:53:28 -05:00

113 lines
5.1 KiB
YAML

version: "2"
sql:
- engine: "postgresql"
schema:
- "../db/migrations/"
- "../db/sqlc_schemas.sql"
queries: "queries/"
gen:
go:
package: "billing"
out: "."
sql_package: "database/sql"
emit_json_tags: true
emit_prepared_queries: false
emit_interface: true
emit_exact_table_names: false
emit_empty_slices: true
omit_unused_structs: true
rename:
core_account: Account
core_accounts: Account
core_price: Price
core_prices: Price
core_product: Product
core_products: Product
core_subscription: Subscription
core_subscriptions: Subscription
core_subscription_item: SubscriptionItem
core_subscription_items: SubscriptionItem
core_subscription_change: SubscriptionChange
core_subscription_changes: SubscriptionChange
core_subscription_scheduled_change: SubscriptionScheduledChange
core_subscription_scheduled_changes: SubscriptionScheduledChange
core_invoice: Invoice
core_invoices: Invoice
core_invoice_line_item: InvoiceLineItem
core_invoice_line_items: InvoiceLineItem
core_payment: Payment
core_payments: Payment
core_payment_method: PaymentMethod
core_payment_methods: PaymentMethod
core_plan_ladder: PlanLadder
core_plan_ladders: PlanLadder
core_plan_ladder_tier: PlanLadderTier
core_plan_ladder_tiers: PlanLadderTier
core_product_kind: ProductKind
core_product_kinds: ProductKind
# Spillover tables pulled in because ../db/migrations/ declares the
# whole "core" schema. Renamed to match the exact pre-consolidation
# type names (from their old owning schema) so model diffs stay
# schema-string-only -- see internal/integration/sqlc.yaml for the
# canonical mapping this list is drawn from.
core_person: IdentityPerson
core_persons: IdentityPerson
core_user: IdentityUser
core_users: IdentityUser
core_organization: OrganizationOrganization
core_organizations: OrganizationOrganization
core_workspace: OrganizationWorkspace
core_workspaces: OrganizationWorkspace
core_role: OrganizationRole
core_roles: OrganizationRole
core_role_assignment: OrganizationRoleAssignment
core_role_assignments: OrganizationRoleAssignment
core_org_member: OrganizationOrgMember
core_org_members: OrganizationOrgMember
core_org_type: OrganizationOrgType
core_org_types: OrganizationOrgType
core_entitlement_set: EntitlementsEntitlementSet
core_entitlement_sets: EntitlementsEntitlementSet
core_entitlement_set_rule: EntitlementsEntitlementSetRule
core_entitlement_set_rules: EntitlementsEntitlementSetRule
core_grant: EntitlementsGrant
core_grants: EntitlementsGrant
core_numeric_entitlement: EntitlementsNumericEntitlement
core_numeric_entitlements: EntitlementsNumericEntitlement
core_numeric_entitlement_contribution: EntitlementsNumericEntitlementContribution
core_numeric_entitlement_contributions: EntitlementsNumericEntitlementContribution
core_numeric_entitlement_usage: EntitlementsNumericEntitlementUsage
core_numeric_entitlement_usages: EntitlementsNumericEntitlementUsage
core_pool_assignment: EntitlementsPoolAssignment
core_pool_assignments: EntitlementsPoolAssignment
core_pool_provision: EntitlementsPoolProvision
core_pool_provisions: EntitlementsPoolProvision
core_pool_provision_ladder: EntitlementsPoolProvisionLadder
core_pool_provision_ladders: EntitlementsPoolProvisionLadder
core_pool_provision_transition: EntitlementsPoolProvisionTransition
core_pool_provision_transitions: EntitlementsPoolProvisionTransition
core_resource_pool: EntitlementsResourcePool
core_resource_pools: EntitlementsResourcePool
core_outbox: IntegrationOutbox
core_outboxes: IntegrationOutbox
core_provider: Provider
core_providers: Provider
core_provider_operation: ProviderOperation
core_provider_operations: ProviderOperation
core_provider_state: IntegrationProviderState
core_provider_states: IntegrationProviderState
core_resource_key: ResourceKey
core_resource_keys: ResourceKey
core_webhook_event: IntegrationWebhookEvent
core_webhook_events: IntegrationWebhookEvent
overrides:
- db_type: "uuid"
go_type: "string"
# core.product_shape's two rule counts are COALESCE over a grouped
# count, which sqlc cannot type on its own; the view's contract
# (product-catalog) is that both report a number in every case.
- column: "core.product_shape.active_rule_count"
go_type: "int64"
- column: "core.product_shape.per_unit_rule_count"
go_type: "int64"