我是否正确解析了数据库关系?

时间:2017-10-23 10:07:41

标签: database entity-relationship

如果这个问题出错,我很抱歉。我自愿参加一个必须存储敏感数据的慈善团体,因为我们是一种新型格式,没有符合我们需求或预算的系统。其他人开始建立数据库,我不确定他是否正确解决了这种关系,所以我给他提供了一个替代的ER模型,现在我们还没有收到他的回复,所以我不得不自己构建它。登记/> 由于我们必须存储敏感数据,我不愿意将我的数据库设计全部放在这里,所以如果有办法我可以私下与某人讨论这个问题,那将是我的偏好,因为我希望得到某人否则要全面检查以确保它一切都好...但是现在,有人可以确认我是否正确解决了这些关系,或者原设计是否更好?

数据库描述是:有不同类型的成员 -

##
## SSL Virtual Host Context
##

<VirtualHost _default_:443>

# General setup for the virtual host, inherited from global configuration
#DocumentRoot "/var/www/html"
#ServerName www.example.com:443

# Use separate log files for the SSL virtual host; note that LogLevel
# is not inherited from httpd.conf.
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on

#   List the protocol versions which clients are allowed to connect with.
#   Disable SSLv3 by default (cf. RFC 7525 3.1.1).  TLSv1 (1.0) should be
#   disabled as quickly as practical.  By the end of 2016, only the TLSv1.2
#   protocol or later should remain in use.
SSLProtocol all -SSLv3
SSLProxyProtocol all -SSLv3

#   User agents such as web browsers are not configured for the user's
#   own preference of either security or performance, therefore this
#   must be the prerogative of the web server administrator who manages
#   cpu load versus confidentiality, so enforce the server's cipher order.
SSLHonorCipherOrder on

#   SSL Cipher Suite:
# List the ciphers that the client is permitted to negotiate.
# See the mod_ssl documentation for a complete list.
# By leaving this directive commented out, the system-wide OpenSSL
# default is used.  See update-crypto-policies(8) for more details.
#SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
#SSLProxyCipherSuite HIGH:MEDIUM:!aNULL:!MD5

#   Point SSLCertificateFile at a PEM encoded certificate.  If
#   the certificate is encrypted, then you will be prompted for a
#   pass phrase.  Note that restarting httpd will prompt again.  Keep
#   in mind that if you have both an RSA and a DSA certificate you
#   can configure both in parallel (to also allow the use of DSA
#   ciphers, etc.)
#   Some ECC cipher suites (http://www.ietf.org/rfc/rfc4492.txt)
#   require an ECC certificate which can also be configured in
#   parallel.
SSLCertificateFile /etc/pki/tls/certs/localhost.crt

#   Server Private Key:
#   If the key is not combined with the certificate, use this
#   directive to point at the key file.  Keep in mind that if
#   you've both a RSA and a DSA private key you can configure
#   both in parallel (to also allow the use of DSA ciphers, etc.)
#   ECC keys, when in use, can also be configured in parallel
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

#   Server Certificate Chain:
#   Point SSLCertificateChainFile at a file containing the
#   concatenation of PEM encoded CA certificates which form the
#   certificate chain for the server certificate. Alternatively
#   the referenced file can be the same as SSLCertificateFile
#   when the CA certificates are directly appended to the server
#   certificate for convenience.
#SSLCertificateChainFile /etc/pki/tls/certs/server-chain.crt

原始人通过为每个用户创建一个单独的表来解决这个问题,每个表都存储了一个名称和地址,例如:

Client, Staff, Professional (Offsite), Supplier, Family, General.  There are different types of Staff members: Managers, Volunteer, Professional (Onsite), Admin, Committee, Lecturer. A member can be one or many types eg: Client/Volunteer/Family, Supplier/Volunteer, Manager/Lecturer/Volunteer/Committee/Family.

我唯一的问题是,我希望一个人拥有一个带有他们姓名和地址的会员ID,但是对于原始设计,每个人对于每种类型的人都会有不同的ID,所有存储名称,地址,电话号码,电子邮件等。

我认为创建一个Member表并拥有一个带有加入的Member Type List表的Member Type表是一个更好的设计。这就是我解决问题的方法:

apache documentation

我是否正确完成了这项工作,还是应继续使用原始设计?

由于

更新

Member Tables

1 个答案:

答案 0 :(得分:0)

将所有成员相关数据存储在一个表中是有意义的。 另外,对于编程,我无法想象任何支持为每个成员类型使用不同表的用例。

话虽如此,我建议你查阅“用户角色”的概念,因为这看起来非常相似。

您拥有不同的用户(成员),他们可以拥有不同的角色(成员类型)。根据您的角色,您可能希望显示不同的数据/允许不同的操作/发送特定的邮件(或您可以想象的任何其他内容)。

所以一般来说你的方法看起来不错。我唯一想到的是,现在你没有存储谁是“员工”成员。如果您只有一个具有不同名称的列表,则不存储该结构。 根据您的使用情况,您可以例如在MemberType表“isStaff”中创建另一列。或者,如果您需要更灵活并且将来可能有更多不同的成员类型,您可以创建另一个表(例如)MemberTypeParent并在您的MemberType表上将该外键设置为该表以建立连接

这完全取决于您将来要对数据做些什么。