fix(membership-fees): add DB constraints for enum and decimal precision
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Moritz 2025-12-11 17:06:10 +01:00 committed by moritz
parent 4d1b33357e
commit ebbf347e42
6 changed files with 81 additions and 8 deletions

View file

@ -294,8 +294,8 @@ Table custom_fields {
Table membership_fee_types {
id uuid [pk, not null, default: `uuid_generate_v7()`, note: 'UUIDv7 primary key']
name text [not null, unique, note: 'Unique name for the fee type (e.g., "Standard", "Reduced")']
amount decimal [not null, note: 'Fee amount in default currency']
interval text [not null, note: 'Billing interval: monthly, quarterly, half_yearly, yearly (immutable)']
amount numeric(10,2) [not null, note: 'Fee amount in default currency (CHECK: >= 0)']
interval text [not null, note: 'Billing interval (CHECK: IN monthly, quarterly, half_yearly, yearly) - immutable']
description text [null, note: 'Optional description for the fee type']
indexes {
@ -335,8 +335,8 @@ Table membership_fee_types {
Table membership_fee_cycles {
id uuid [pk, not null, default: `uuid_generate_v7()`, note: 'UUIDv7 primary key']
cycle_start date [not null, note: 'Start date of the billing cycle']
amount decimal [not null, note: 'Fee amount for this cycle (historical record)']
status text [not null, default: 'unpaid', note: 'Payment status: unpaid, paid, suspended']
amount numeric(10,2) [not null, note: 'Fee amount for this cycle (CHECK: >= 0)']
status text [not null, default: 'unpaid', note: 'Payment status (CHECK: IN unpaid, paid, suspended)']
notes text [null, note: 'Optional notes for this cycle']
member_id uuid [not null, note: 'FK to members - the member this cycle belongs to']
membership_fee_type_id uuid [not null, note: 'FK to membership_fee_types - fee type for this cycle']