Defining two user types in the DB

Hi everyone,

My own Christmas gift is a wappler subscription this month! I’m finishing reviewing a few webinars/tutorials and I’ll join for a project. But a question remains:

I’m going to build a platform matching users seeking help and consultants.
I have a general users table with info that is common to both users and consultants (fname, lname, emails, pwd, and is_consultant boolean field 0/1) and a consultant table (with a user_id as FK) with info pertaining to consultants only (title, category, bio, pic…). Users must signup for browsing consultants detailed bio, messaging them internally, submitting tenders,… Consultant with a profile will have their own dashboard, can reply to users’ tenders,…
Can the boolean system do the work of controlling info access like user’s access to consultant’s bio for example and features like consultant’s bidding on user’s tenders or is it better to create a table for defining roles (U for users seeking help and C for consultants) based on @Hyperbytes websinar?

Thank you! :evergreen_tree:

Personally i would go for a roles table allowing multiple permissions for any user (So a consultant could also be a user for example) as per this post

1 Like

Very kind of you.
Quick fix done, with a 3-column permission tbl (id ; user_id_fk and role as ENUM “U”,“C”).
Thanks!

Personally I never use emum fields as they don’t work well with selects/ radio buttons, prefer a proper table but if it works for you…

Interesting…
I won’t use radio button or dropdown, regular users and consultants will use different signup forms.
Think I should go for CHAR(1) instead?

I normally use a separate table with char(1), i find managing multiple roles much easier that way but if what you have works for you then that’s great. I guess i just have an inbuilt hatred of enum fields, they kind of go against the idea of relational tables I also hate comma separated lists in fields, they should be a separate table!!!

2 Likes