停留在用户管理应用程序的数据库设计上
我正在尝试编写一个用户管理应用程序,但对如何正确构建数据库感到困惑。
我认为数据库设计的结构如下:
Users
- user_id
- first_name
- last_name
Accounts
- account_id
- ldap_access
- drupal_access
- billing_app_access
- facebook_access
Notes
- note_id
- description
- date_linked
我相信映射会是这样的:
一个用户可以有一组帐户 (1:1)
一组帐户可以有很多用户 (1:m)
一组帐户可以有很多笔记 (1:m)
许多笔记可以有许多帐户集 (m:m)
这是构建数据库的正确方法吗?我真的很困惑,因为我希望应用程序字段对于该特定用户来说是布尔值真/假。 (无论他们是否有帐户),注释将对应于帐户数据库中的每个字段。 (即:note_id:1将对应于用户johndoe,应用程序:facebook,note_description =“用户不再有facebook”)
这有意义吗?
任何帮助将不胜感激!
I'm trying to write up a user management app, but getting confused about how to structure the database properly.
I think the database design would be structured something like this:
Users
- user_id
- first_name
- last_name
Accounts
- account_id
- ldap_access
- drupal_access
- billing_app_access
- facebook_access
Notes
- note_id
- description
- date_added
And I believe the mapping would go like this:
One user can have one set of accounts (1:1)
One set of accounts can have many users (1:m)
One set of accounts can have many notes (1:m)
Many Notes can have Many Sets of Accounts (m:m)
Is this the correct way to structure the database? I'm really confused since I would like the applications fields be a boolean true/false for that particular user. (If they have an account on there or not), and the notes would correspond to EACH of the fields within the Accounts database. (ie: note_id:1 would correspond to user johndoe, application: facebook, note_description = "user no longer has facebook")
Does this make sense?
Any help would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许是这样的:
我仍然不明白您的所有需求。
Mayby something like this:
I still don't understand all your needs.
我更喜欢这种设计(在Windows或Oracle等许多系统中使用
)
用户
用户角色
角色
使用权
应用
注意(仍然想知道这是做什么的)
如果您有许多具有相似特征的用户,角色很有用。
I prefer this design (used in many system like Windows or Oracle)
Table
User
User-Role
Role
Access
Application
Note (still wonder what this for)
Role useful if you have many user with similar characteristic.