Seb
Seb

Reputation: 25157

Referrals DB schema

I'm coding a new {monthly|yearly} paid site with the now typical "referral" system: when a new user signs up, they can specify the {username|referral code} of other user (this can be detected automatically if they came through a special URL), which will cause the referrer to earn a percentage of anything the new user pays.

Before reinventing the wheel, I'd like to know if any of you have experience with storing this kind of data in a relational DB. Currently I'm using MySQL, but I believe any good solution should be easily adapted to any RDBMS, right?

I'm looking to support the following features:

Note that I'm not planning to use this in any other project, so I'm not worried about it being "plug and play".

Have you done any work with similar requirements? If so, how did you handle all this stuff? Would you recommend any particular DB schema? Why?

Is there anything I'm missing that would help making this a more flexible implementation?

Upvotes: 1

Views: 4105

Answers (1)

Brian Agnew
Brian Agnew

Reputation: 272377

Rather marvellously, there's a library of database schemas. Although I can't see something specific to referrals, there may be something related. At least (hopefully) you should be able to get some ideas.

Upvotes: 2

Related Questions