Skip to content

Create schema for tracking credits

What we're after

Create a database schema for tracking the granting and usage of credits for all organizations. Basic queries are in scope as needed; transacting against credits will be handed by [].

Each organization has an account that can hold credits. It is granted credits when its IAA Period of Performance begins. The credits granted are based on the tier assigned to the organization. Prorated credits may be granted if the tier is changed partway through the agreement. Credits will be regularly deducted based on usage. Unused credits will be dedicated at PoP end.

See related tickets for more details about transactions. Only schema design is in scope for this ticket. (Or, they can be done at the same time if that makes sense.)

Potential metrics

  • Create unit tests as appropriate to test the functioning of the schema.
  • Validate the schema with sqlc.

Security considerations

Administrative credits operations will be handled in [].

Notes for implementers

We should most likely use a double-entry bookkeeping / accounting system to represent customer accounts and usage. A few resources for implementing such a system are here:

Related issues/sub-projects

  • #3304