In my application, I’d like the user to select his working days. then store them in the database. Of course my application will process the users’ data like: Is today a working day for a specific user, who are the users that should work today , … etc.
My question is, what is the best practice for doing this? should I use:
- Bitmasking field in the users table
- Many to many relationships tables by creating table for days, users and days_users.
Thank you in advance.
I would say that bit mask fields are a relational anti-pattern.
A field should have a single meaningful value, otherwise you end up with querying issues – parsing the field every time you need to query using it.
Such a field also requires extra documentation, as the values it stores are not self describing.