Files
finance-app/prisma/migrations/0009_split_payments/migration.sql
T
siddharthd 85e7801407 feat(shared): replace settle buttons with payment ledger
- New split_payments table records actual payments between participants
- Balance = total split obligations - total payments (splits never marked settled)
- Record Payment modal per participant: direction toggle, amount pre-filled with balance, date, notes
- Payment history inline on each balance card with +/- display and delete
- Per-transaction Settle button removed; Action column removed from shared table
- Splits always show the true cost breakdown regardless of payment state
2026-03-14 21:09:00 +11:00

14 lines
614 B
SQL

CREATE TABLE split_payments (
id SERIAL PRIMARY KEY,
from_participant_id INTEGER NOT NULL REFERENCES participants(id),
to_participant_id INTEGER NOT NULL REFERENCES participants(id),
amount DECIMAL(10,2) NOT NULL CHECK (amount > 0),
payment_date DATE NOT NULL,
notes TEXT,
linked_transaction_id INTEGER REFERENCES transactions(id) ON DELETE SET NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_split_payments_from ON split_payments(from_participant_id);
CREATE INDEX idx_split_payments_to ON split_payments(to_participant_id);