|
structure question
I will do my best to try to explain here what im trying to do.
I want to do a new table that consists of items purchased but its not your basic purchase table.
This table will be used in an environment which it costs you credits to do stuff. Lets take this site for instance codingforums. Lets say for me to post this question it costs me 10 credits and each credit lets say is worth a penny so it costs me a dime to post this.
I not only need to record that i purchased for credit deduction i also need to record this for history sake because now that i have paid the credit, any replys to this post i can answer for free.
So you kinda where im going with this, to record that i paid for a feature and there will be quite a few (sending email, looking at vids etc)
So i am sitting here thinking about table structure.
A. I could have a multi field table that lists all the features as fields and then just make one row each time a purchase is made and then find that row if i need it. But that could end up being alot of rows.
B. or i could have one table per feature and then list who bought that feature by having the table field as a stored array listing every member that purchased that feature then all i have to do is pull the row, do a quick search of the array to see if the member id is in there and thats it.
The problem i am having is that there are pros and cons to each choice, and i have not decided which way to go yet. Usually what happens many times is that (sort of like a painting) once i get to working on it, it decides which way to go for me and takes on its own life sort of.. lol
Any suggestions.. Thanks.
Thought i would add alittle layout here of choice A and B above.
A. Feature table
field names Feature1 feature2 feature2 and so on
for every purchase a new row with one of those featuresfields having new data (so basically the rest of the row is wasted)
b.
Feature 1 table
Row whopurchased (field which contains an array of userid's)
Feature 2 table
Row whopurchased (field which contains an array of userid's)
Feature 3 table
Row whopurchased (field which contains an array of userid's)
Maybe that will make alittle more sense now.
Last edited by durangod; 11-26-2012 at 02:06 PM..
|