lundi 27 juin 2016

Classpass.com like database design

I am trying to get my head around creating classpass like database design. I'm new to database design and there are a few things that are not quite for me how to implement them and I can't quite get my head around.

You can check the classpass example:

EDIT 1: So here is the idea: Each city have multiple neighbourhoods having multiple studios/venues.

After reading spencer7593's comment, here is what I came with and the things that are still not quite clear:

First try

So what I am not quite sure about is:

  1. I am not sure how to store the venue/studio address and geolocation. Is it better to have table Region which defines id | name | parent_id and stores the cities and the neighborhoods recursively? Or add a foreign key constraint to city and neighborhoods? Should I store the lan/lon into the venue table, into the address or even separate locations table? I would like to be able to perform searches like:

    • show me venues in that neighborhood or city
    • show me venues which are in radius XX from position
  2. Each class should have a schedule and currently I am not sure how to design it. For example: Spinning class, Mo, We, Fr from 9 AM till 10 AM. I would like to be able to do queries like:

    • show me venues, which have spinning classes on Mo
    • or show me all classes in category Spinning, Boxing for example
    • or even show me venues offering spinning classes
  3. Should I create an extra table schedules here? Or just create some kind of view which creates the schedule? If it's an extra table, how should I describe start, end of each day of the week?

Aucun commentaire:

Enregistrer un commentaire