As per the title, when creating a typical saas app, I currently have the following tables and questioning whether they should be all put into the users table
- users (id, password_hash, user_type, first_name, last_name, timezone, language, two_factor_auth_enabled, two_factor_auth_secret, two_factor_auth_type, etc.) - should any of these be separated out?
- notifications (marketing emails, new features, user_id, etc.)
- preferences (website font size, website theme, user_id)
- secondary email (email, verifiedAt, createdAt, user_id)
- plan (plan_name, user_id, etc.)
- historical_passwords (password_hash, createdAt, updatedAt, user_id)
I currently have all these as separate tables, but not sure if some of these should be JSON blobs or just merged into the main users table since several of these are one-to-one relationships (notifications, preferences, plan).
The others won't have a lot of data so wondering if they should be JSON blobs in the users table (secondary email, historical passwords)
What is most efficient for the database and what is typical / best practice?