We've been developing user based payment system. It's pretty much metering how much users use some contents per hour. And we send the bill at the end of every month.
I'd love to know how user based payment system table can be implemented. Any documentation or resources?
This is meant for database deign not algorithm. But in my mind there are two ways to achieve it. Also if you have an experience to implement something like this, please give me some advice.
event status model ( standing for "on/off" status )
whenever you create contents, 1 will be inserted, on the other hand -1 will be inserted if you destroy that. And we can only calculate from 1 to -1 part.
It's just good because we can skip start point if you already started.
create create create destroy
1 1 1 -1
So there are many events inserted in one table (start/stop)
It would be more simple. contents has columns "created_at" and "destroyed_at". Just whenever you create/destroy some content, the time will be inserted for each column.
Which is more efficient or any other ways?
Personally the second is little cleaner, but i'd also love to hear some opinions.