feat(membership-fee): index fee cycles by member, status and end date

This commit is contained in:
Simon 2026-07-10 16:27:14 +02:00
parent cdb8b03ce1
commit 4b647c21e7
3 changed files with 238 additions and 0 deletions

View file

@ -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