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);