Home > Enterprise >  How to store unregistered users in database?
How to store unregistered users in database?

Time:01-16

I have a table that contains users of my system. The order table has columns:

id | user_id | price

Where user_id is foreign key.

Problem is that if user not registered there is no user_id. It means order cannot be placed because violates the integrity.

CodePudding user response:

Make user_id nullable and insert a NULL, if there's no user associated with an order.

CodePudding user response:

add a column to your user table where you mark if he is registered or not.

With this you can make the whole registration process, if need be, else you keep the unregistered users, till taxes and law it requires and the delete the users whenit is proper.

  •  Tags:  
  • Related