This looks good but some of the background has the air of the kind of artificial problems presented in late night infomercials: > It’s impossible to split a single payment into multiple payouts, since there is a many-to-one relationship of payments to payouts. So your model used a many-to-one relationship when you really wanted a many-to-many? > Since this is just a SQL database, there’s nothing preventing the payout…
(Disclaimer: I work at Square, but not on Books.) >Preventing inconsistencies by enforcing constraints is a key point of an RDBMS. This is literally why people use SQL DBs. This comment is not specific or related to the work at hand, but note that this is only true for a single-machine database or a sharded setup in which you never have to perform transactions across shards. That is, the ACID guarantees are only enfo…
From the Cockroach documentation (source: https://www.cockroachlabs.com/docs/stable/transactions.html )
> CockroachDB supports bundling multiple SQL statements into a single all-or-nothing transaction. Each transaction guarantees ACID semantics spanning arbitrary tables and rows, even when data is distributed.