# Multi-account billing schema

**URL:** <https://hub.soprani.ca/t/multi-account-billing-schema/194>\
**Category:** Issues\
**Tags:** implemented, sgx-jmp\
**Created:** [April 27, 2022, 8:14pm UTC](https://hub.soprani.ca/t/multi-account-billing-schema/194 "2022-04-27T20:14:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![singpolyma](https://hub.soprani.ca/user_avatar/hub.soprani.ca/singpolyma/32/11_2.png) [@singpolyma](https://hub.soprani.ca/u/singpolyma)\
**Post date:** [April 27, 2022, 8:14pm UTC](https://hub.soprani.ca/t/multi-account-billing-schema/194/1 "2022-04-27T20:14:00Z")

</div>

- Add column to plan\_log for parent\_customer\_id
- CHECK trigger that plan\_log inserts with a non-NULL parent use the same plan\_name as parent
- customer\_plans view should include the parent
- balance view joins customer\_plans and gets balance from parent if parent exists else same as now
- INSERT BEFORE trigger on transactions checks if the customer id has a parent and inserts to that instead if so
- TrustLevelRepo checks if customer has a parent and gets trust level for that customer instead if so

---

<div class="post-metadata">

**Author:** ![system](https://hub.soprani.ca/user_avatar/hub.soprani.ca/system/32/18_2.png) [@system](https://hub.soprani.ca/u/system)\
**Post date:** [October 19, 2026, 6:03pm UTC](https://hub.soprani.ca/t/multi-account-billing-schema/194/2 "2026-10-19T18:03:34Z")

</div>



---

<div class="post-metadata">

**Author:** ![singpolyma](https://hub.soprani.ca/user_avatar/hub.soprani.ca/singpolyma/32/11_2.png) [@singpolyma](https://hub.soprani.ca/u/singpolyma)\
**Post date:** [April 27, 2022, 8:18pm UTC](https://hub.soprani.ca/t/multi-account-billing-schema/194/3 "2022-04-27T20:18:57Z")

</div>

When parent is NOTIFY to bill, probably check and bill children.

---

<div class="post-metadata">

**Author:** ![singpolyma](https://hub.soprani.ca/user_avatar/hub.soprani.ca/singpolyma/32/11_2.png) [@singpolyma](https://hub.soprani.ca/u/singpolyma)\
**Post date:** [April 27, 2022, 8:21pm UTC](https://hub.soprani.ca/t/multi-account-billing-schema/194/4 "2022-04-27T20:21:54Z")

</div>

LowBalance.for(customer) should detect if customer has a parent and use that instead

---

<div class="post-metadata">

**Author:** ![singpolyma](https://hub.soprani.ca/user_avatar/hub.soprani.ca/singpolyma/32/11_2.png) [@singpolyma](https://hub.soprani.ca/u/singpolyma)\
**Post date:** [August 3, 2022, 6:50pm UTC](https://hub.soprani.ca/t/multi-account-billing-schema/194/5 "2022-08-03T18:50:43Z")

</div>

This CHECK is both hard and doesn’t keep the data consistent over time. We discussed in MUC to trust the data model on this point for now.
