Re: Customer user and factory user in the same table

From: Jerry Stuckle <jstucklex_at_attglobal.net>
Date: Sat, 10 Aug 2019 11:11:59 -0400
Message-ID: <qimmrp$h5b$1_at_jstuckle.eternal-september.org>


On 8/10/2019 9:01 AM, ^Bart wrote:
> Hi everybody,
>
> I have a dubt about how to store users in my db, I'd like to store
> customer users and factory users (for example the owner of a shop!) in
> the same table.
>
> A customer will insert date of birth, and personal information and a
> factory user will insert for example a website, the brand of its shop, etc.
>
> I didn't set above fields like "not null" so in the same table I can
> store both!
>
> But... if a customer user is also a factory user he should have two
> different e-mails to have two different account!
>
> It could be a good idea to store everyone like customers and enable a
> button like ENUM ("customer", "customer_and_factory") or true/false!
>
> PRO: in this case the user could use just one email.
> CON: if a factory got more than one owner it will not possible to add
> other users!
>
> I know it could be possible to enable a factory group but it's not so
> easy because I should add an "admin" for the group to manage add/delete
> features, etc.
>
> Regards.
> ^Bart

[Quoted] Customer users and factory users are not the same thing so should not be in the same table.

[Quoted] I would have four tables. A user table with userid, password and anything else common to both types. Then a customer_user table with specific customer-user specific information and a foreign key leading back to the user table.

[Quoted] And since you may have more than one owner of a factory, have a factory-user table with information specific to that factory and a link table joining the user and factory-user tables.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex_at_attglobal.net
==================
Received on Sat Aug 10 2019 - 17:11:59 CEST

Original text of this message