Advice on handling positive and negative decimals?
16 views
Skip to first unread message
pbreit
unread,
May 19, 2016, 6:32:38 PM5/19/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web2py-users
What's the prevailing best practice for storing financial debits and credits in the DB?
1 table of both or 2 tables (1 for each)?
1 column of positive and negative values or 2 columns (amount and type)?
store as integers (cents) or decimals (dollars)?
villas
unread,
May 19, 2016, 7:09:14 PM5/19/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web2py-users
I have given this quite a bit of thought in the past. In the end, I decided one column of decimals, positive and negative does a good job. It has always worked well for me and I have never had any reason to doubt it was the right thing to do.
There are no doubt other opinions, and other circumstances, YMMV :)