简体   繁体   English

数据库设计问题...预订应用程序

[英]database design issue…for booking app

I have 4 tables,one is credentials(it holds an id, email and password), the other 2 are for business users and regular users of the app. 我有4个表,一个是凭证(它包含ID,电子邮件和密码),另外两个是商业用户和应用的常规用户。 The business users table holds crID(foreign key)name,lastname,address etc... The regular users table holds crID(foreign key),name,lastname etc... 业务用户表包含crID(外键)名称,姓氏,地址等...常规用户表包含crID(外键),名称,姓氏等...

The 4th is the booking table, it holds a bookingID, bookedfrom,bookedfor(the last 2 being foreign keys that point to the credentials table). 第四个是预订表,它包含一个预订ID,预订,预订(最后两个是指向凭证表的外键)。

If a regular user registers in the site he closes a bookingslot and that is stored in the booking table, his name,last name are stored in the regular users table and his credentials in the credentials table. 如果常规用户在站点中注册他关闭预订表并且存储在预订表中,则他的姓名,姓氏存储在常规用户表中,并且他的凭证存储在凭证表中。

The business user table just holds the business user for which a booking is made by the regular users. 业务用户表仅保存由常规用户进行预订的业务用户。

Here is a graph: db image 这是一张图: db image

The question is what to do if a regular user does not choose the web to make the booking but makes a call. 问题是如果普通用户没有选择网络进行预订但是拨打电话该怎么办。 The business users are given the option to make the booking "manually" also. 业务用户也可以选择“手动”进行预订。 I am just having difficulty how to integrate that in the db. 我很难将如何在db中集成它。

As I see it I need to make the following: 在我看来,我需要做以下事情:

  1. Create a booking slot in the bookings table 在预订表中创建预订位置
  2. Create a new regular user entry in the regular users table and at the same time create another column that would indicate if the user is registered or not. 在常规用户表中创建一个新的常规用户条目,同时创建另一个列,指示用户是否已注册。
  3. create an entry in the credentials table but without password/email since this he will not be a registered user...he just made a booking using the phone. 在凭证表中创建一个条目,但没有密码/电子邮件,因为他不会是注册用户......他只是使用电话预订。

WHat is your opinion.If you want I will post some show create statements. 你的意见是什么。如果你想要我发布一些show create语句。 I think I made my point. 我想我明白了。

I would personally merge business users , normal users and optionally credentials in one single users table. 我个人会将business usersnormal users和可选credentials合并到一个users表中。

Since I don't see the need of two seperate tables for your users, it would simplify drastically your data model. 由于我不认为您的用户需要两个单独的表格,因此可以大大简化您的数据模型。 You just need a flag to determine if the user is a business user or a normal user. 您只需要一个标志来确定用户是业务用户还是普通用户。

For the rest, I think that having a null password is enough to determine if the user hasn't registered yet. 对于其他人,我认为拥有空密码足以确定用户是否尚未注册。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM