feat(membership-fee): index fee cycles by member, status and end date
This commit is contained in:
parent
cdb8b03ce1
commit
4b647c21e7
3 changed files with 238 additions and 0 deletions
|
|
@ -36,6 +36,16 @@ defmodule Mv.MembershipFees.MembershipFeeCycle do
|
|||
postgres do
|
||||
table "membership_fee_cycles"
|
||||
repo Mv.Repo
|
||||
|
||||
custom_indexes do
|
||||
# Serves the period-scoped unpaid-cycle count on the member overview:
|
||||
# count of a member's cycles with status = :unpaid and cycle_end in the
|
||||
# active period. The composite (member_id, status, cycle_end) lets the
|
||||
# aggregate seek the per-member unpaid slice and range-scan cycle_end
|
||||
# without touching paid/suspended rows.
|
||||
index [:member_id, :status, :cycle_end],
|
||||
name: "membership_fee_cycles_member_status_end_index"
|
||||
end
|
||||
end
|
||||
|
||||
resource do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue