企业云服务需要怎样的数据库设计
我正在为企业云服务规划一个数据库。该服务将包含两个 Web 应用程序,一个是仓库管理系统,另一个是发票应用程序。
公司可以注册并成为该服务的“用户”,然后他们可以在线拥有他们的库存和发票系统。
我应该将所有用户/公司保留在同一个表中,还是应该为每个用户分配一个表/应用程序?如果所有用户/公司使用相同的数据库表,维护会容易得多,但我认为如果每个用户/公司使用一张表,在发票上实现序列号会更容易。
每个用户/公司的库存/仓库最多包含 5,000 件物品。
每张发票都需要有一个序列号,第一张发票从 1 开始。因此,如果每个用户/公司有一个表,那么自动增量列将是一个好主意。或者,如果我将所有公司放在同一个表中并使用 company_id
列,我应该如何解决?
我应该如何为这样的应用程序设计数据库?我将使用 MySQL 作为 DBMS。
I'm planning a database for an enterprise cloud service. The service will be two web applications, one Warehouse management system and one for Invoices.
Companies can signup and become a "user" of the service, then they can have their Inventory and Invoice system online.
Should I keep all users/companies in the same table or should I have one table/application per user? It would be much easier to maintain if all users/companies use the same database table, but I think it would be easier to implement the serial number on invoices if I use one table per user/company.
The Inventory/Warehouse will contain up to 5,000 items per user/company.
Each Invoice are required to have a serial number, starting from 1 for the first invoice. So an Auto-Increment-column would be a good idea, if I have one table per user/company. Or how should I solve it if I put all companies in the same table and use a company_id
-column?
How should I design the database for such an application? I will use MySQL as DBMS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第一张发票从 1 开始:这可能不是一个好主意。潜在客户在加入您的服务之前可能已经过着美好的生活。
如果我把所有公司放在同一个表中,我应该如何解决这个问题:只需计算该客户的 InvoiceId 的最大值,然后递增它。
starting from 1 for the first invoice: that's probably not a good idea. Potential customers probably had a life before they join your service.
how should I solve it if I put all companies in the same table: just calculate the MAX of InvoiceId FOR THAT CUSTOMER, then increment it.