[thelist] Schema for "Rollover Minutes"

Bill Moseley moseley at hank.org
Thu Feb 26 23:48:20 CST 2009


On Thu, Feb 26, 2009 at 09:40:15PM -0500, Matt Warden wrote:

Thanks for your comments Matt,


> This is basically what I suggested, except you don't have anything
> representing an account state in your data model,

The account state is stored in another table -- really it's a mix of
columns from a few tables -- the account has an "active" flag, but the
account's state is also determined by if there's an active plan still
in effect associated with the account and the plan has minutes.

> and you've mixed "credits" and usage, which I don't agree with.

But your bank statement is just a ledger of mixed credits (deposits)
and usage (withdraws).  Perhaps we are talking about two different
things, though.

> You have transaction history and you must derive the account state.
> I don't agree that doing otherwise would be "managing totals"
> anymore than tracking an x month subscription to a service is
> managing totals. You have an account credit against which you are
> drawing down through usage.

What I meant by managing totals is by having a column that each
transaction adds to instead of just summing up the value of the
transactions.  That would be a denormalized value.

> I would define an inactive account as an account which has no
> un-expired minutes. You track minute lots separately, each lot with
> its expiration date (which can be updated based on your renewal
> business logic).

So, the user purchases these lot, and each lot (a row in a table) has
some quantity of minutes and an expiration date.  Then a transaction
(e.g. some minutes of usage) would be associated with that lot (i.e.
the transaction references the lot), or that the transaction actually
adds some value to the lot?

    cur_lot.used_minutes += call_minutes;

-- 
Bill Moseley
moseley at hank.org
Sent from my iMutt




More information about the thelist mailing list