gputignano's avatar

Customers Vs Users

Accordind to your experience in an ecommerce site create 2 separate tables (the first for customers and the second for admins) is better than create one only table for both?

0 likes
6 replies
nolros's avatar

@gputignano good question.

In my opinion if they are going to auth into your system them you would keep all users as user. Like me I suspect developers get concerned about storing public user data and internal user data in the same DB and in large apps and companies it probably makes sense to separate, but I've now come to the conclusion that if they can get at any table in my DB then my entire DB is compromised so in that case all users in on table, but organization, opportunity, contact, address, orders, etc. would be in other tables.

@JarekTkaczyk hate to bug you, but would really like to hear your opinion on this topic if you have a second.

bobbybouwmann's avatar

You can create a users table with a role attribute right? If there is one one or two fields that split the two groups then I would recommend to put it in one table ;)

1 like
JarekTkaczyk's avatar

@gputignano @nolros It's a broad question.

Depends on the domain, you may create separate tables and link customer row with user row in order to let them login. You may create one table and only assign roles. It depends on how you invoice the customers - if you let them provide different data for each order, then no reason for 2 tables. If you don't, then I would separate them.

2 likes
sitesense's avatar

I don't really see any advantage in having different tables, however I see many disadvantages - for example, handling User IDs would no longer be a simple task which opens a bunch of issues alone.

JarekTkaczyk's avatar

@sitesense It is normalization.

It's not about having different tables for users (admins) and users (customers) - you store all users in one table, and for those who are customers related data in the customers table.

sitesense's avatar

@JarekTkaczyk - Yes, I agree :) I was commenting that I don't see the point of having 2 different tables for each type of user.

User's are a single entity after all - with differing attributes (roles or whatever).

Please or to participate in this conversation.