Which is the better schema for a transactions table:
customer_id
type (enum, 'Debit' or 'Credit')
amount (decimal, unsigned)
or
customer_id
amount (decimal, signed... negative numbers are debits, positive numbers are credits)
The second solution seems simpler, but I’m worried I’m missing some potential pitfalls.
The second one is easier, and more efficient. It becomes much easier to query in the future, specifically for balances.