Sub-accounts
Accounts may be organised in a hierarchical manner where an Account may be the parent of one or more child accounts (and such a child account may itself be the parent of another set of child accounts). When organised this way, a change to the balance of a child Account will be applied to the corresponding balance of its parent. Thus, rolled-up summary accounts may easily be modelled.
This is illustrated below:
graph TD A1[Account A1]:::darkpink --> A2[Account A2]:::pink A1 --> A3[Account A3]:::pink A1 --> A4[Account A4]:::pink A3 --> A3A[Account A3A]:::lightpink A3 --> A3B[Account A3B]:::lightpink B1[Account B1]:::darkgreen --> B2[Account B2]:::green B1 --> B3[Account B3]:::green B1 --> B4[Account B4]:::green B3 --> B3A[Account B3A]:::lightgreen B3 --> B3B[Account B3B]:::lightgreen classDef lightpink fill:#fef classDef pink fill:#fdf classDef darkpink fill:#dbd classDef lightgreen fill:#efe classDef green fill:#dfd classDef darkgreen fill:#bdb
Constructing an account hierarchy
An account hierarchy is constructed by setting the ParentAccount field of an Account to point to the Account that should be its parent.
erDiagram Account ||--o| Account : ParentAccount