0

I'm trying to create a flexible datamodel and i'm not sure what's the right approach.

My application is used by several clients (big and small). Big clients need all the seperate layers, but small clients only need a few. Here's what i mean:

Flexible requirements

Big client:

  • company
  • rayons
  • locations
  • departments
  • users

Small client:

  • company
  • users

So 'company' and 'users' are always used, but the other ones 'rayons', 'locations' and 'departments' are used depending of the size of the client.

My first thought

I could use stubs to fill the tables for small clients. So they have one hidden 'rayon', 'location' and 'department'. But i get the feeling there is a better solution then this.

So if you have any insight, hint or suggestion; it is all appreciated!

And a final thought: What to do, when i want to add a layer 'country'? I don't see how this is gonna be an easy implementation right now.

  • 1
    Why not just model that by not putting records in those other tables? A normalized data model is your friend, here. – Greg Burghardt Mar 1 at 15:33
  • BTW, this might also be a good fit at dba.stackexchange.com – Greg Burghardt Mar 1 at 17:59
  • You are right about the dba.stackexchange.com. Didn't realise there was one. – Peer Mar 4 at 9:42
  • My problem with a normalized model was the empty levels like 'rayon', 'location' and 'department'. It would be possible with an empty stub, but that would require overhead & no easy way to add a layer like 'country' later on. – Peer Mar 4 at 9:43
0

Figured it out:

First of all, i realize i was not very clear with my question. I meant what to do about the data-model AND how to approach it with different roles.

Solution

Instead of thinking about this in fixed roles, i changed my perspective. I will still create all the layers (companies ... locations ... users), but will not work with roles, but permissions. Because acces is no longer fixed to roles, but permissions, it is the flexibel model i needed.

My datamodel will contain empty stubs when certain layers are not needed. With empty stub i mean 'hidden rayon' or 'hidden location'. If a company grows, these layers are simply activated.

My final thought was about new layers. From the permission point of view there are no issues. But i still need to migrate data to allow this:

(old) a -> c (new) a -> b -> c

I think this is acceptible, because i'm not expecting any changes to my model very soon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.