企业云服务需要怎样的数据库设计

发布于 2024-09-04 18:47:47 字数 524 浏览 2 评论 0原文

我正在为企业云服务规划一个数据库。该服务将包含两个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁吢 2024-09-11 18:47:47

第一张发票从 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文