N
N
Nikita Kolosov2014-04-03 12:50:45
MySQL
Nikita Kolosov, 2014-04-03 12:50:45

How to organize the storage of additional paid user options in the database?

There is a user, the service has paid additional options, some options are combined into packages.
For example, a user can enable the option "notify me of new PMs with a push message" for $5, or the option "do not show when I'm online" for $5. And if he connects both options, he will pay $ 7.
Now the database has a paid_feature table (with a list of available options and their price), user (with a list of users) and user_paid_feature (a bunch of user_id and paid_feature_id, as well as the enabled_at and disabled_at fields with the DATETIME of the corresponding event (on / off))
Question - how to organize cost output when both options are enabled? Of course, with the possibility of further expansion (adding new options and combinations of options with different prices)
Used by MySQL and Yii.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rpsl, 2014-04-03
@Rpsl

Such things are very convenient to store and filter through bitmasks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question