Trying to think of the cleanest way to implement this.
I’m writing out the Schema for an internal application which involves
Sales people requesting Production Orders from Production People.
If someone’s just a sales person, they should land at the sales layout
with only their client accounts.
If someone’s a sales person and an admin, they should land at the sales
layout with everyone’s accounts.
If someone’s production or production with admin, they should land at
the production layout.
So I’m trying to think of the best way to do this. Right now users have
an “is_admin” option in my Users table, so that’s fine. But what about
the account types of either Sales or Production?
Do I create a Sales table and a Production table and add Users to those
tables? Checking against those tables to see if that user is a member of
Or should I create an account_types table, ad sales and production as
records and check against which account type they have?
Or is there an even better solution?
With the first two I listed, it’s very possible there will be a third
account type I need to add later. That means I’d have to either create a
new table for each account type, or if I just add those types to the
account_type records, what happens if someone goes in and deletes one of
the records and I have code checking to see if someone is that type?