Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data model for subscriptions, single purchase products and variable services

I am designing a database for a system that will handle subscription based products, standard one off set price purchase products, and billing of variable services.

A customer can be related to many domains and a domain may have many subscriptions, set priced products or billed variable services related to it.

I am unsure whether to seperate each of these categories into their own 'orders' table or figure out a solution to compile them all into a single orders table.

Certain information about subscriptions is required such as start date or expiry date which is irrelevant for stand alone products. Variable services could be any price so having a single products table would mean I would have to add a new product which may be never used again or might be at a different cost.

What would be the best way to tackle this, and is splitting each into seperate order tables the best way?

like image 810
Michael Ramirez Avatar asked Mar 03 '14 15:03

Michael Ramirez


People also ask

What is subscription based model in software?

The subscription business model is a business model in which a customer must pay a recurring price at regular intervals for access to a product or service.

What is a subscription plan?

A subscription plan is a purchase option. A subscription plan lets you choose how often a product can be delivered. This is called “delivery frequency” For example, weekly delivery. A subscription plan also gives you the ability to add a percentage discount.

Is a subscription a service?

In the modern era, most subscription services function by way of offering access to services or a type of product to an audience (customers) for a particular sum of money paid at regular intervals. This differs from service to service – some monthly, some quarterly and some yearly or for the duration of a season.


1 Answers

Have you looked at sub-typing - it might work for you. By this I mean a central "order" table containing the common attributes and optional "is a"/one-to-one relationships to specific order tables. The specific order tables contain the attributes specific only to that type of order, and a foreign key back to the central order table.

This is one way of trying to get the best of "both" worlds, by which I mean (a) the appropriate level of centralisation for reporting on things common and (b) the right level of specialisation. The added nuance comes at the cost of an extra join some times but gives you flexibility and reporting.

Although I am a little biased in favour of subtypes, some people feel that unless your order subtypes are very different, it may not be worth the effort of separating them out. There is some seemingly good discussion here on dba.stackexchange as well as here. That being said, books (or chapters at least) have been written on the subject!

like image 54
wwkudu Avatar answered Nov 15 '22 00:11

wwkudu