寻求帮助来制定订阅服务架构
我发现很难决定每月订阅服务的模式。特别是,如果我的信用卡表应该与客户或订阅相关。
我目前拥有的表如下:
users
id
other fields.
addresses
id
userid
other fields
subscriptions
id
userid
other fields
cards
id
userid
last4digits
一个用户只能有一个订阅。目前,仅接受信用卡作为付款方式。然而,这种情况未来可能会改变。我的架构很简单,但我担心如果添加更多付款类型,将来更改我的设置会很痛苦。
您能给我一些建议吗?
I'm finding it difficult to decide on a schema for a monthly subscription service. In particular, if my the credit cards table should be related to the customer or to the subscription.
The tables I currently have are the following:
users
id
other fields.
addresses
id
userid
other fields
subscriptions
id
userid
other fields
cards
id
userid
last4digits
A user can only have one subscription. For now, only credit cards are accepted as a form of payment. However, that could change in the future. My schema is simplistic, but I'm afraid my setup will be a pain to alter in the future if more payment types are added.
Can you provide me with some advice please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的数据库设计应该考虑您想要对数据执行什么类型的查询,但是,在不了解更多信息的情况下,如何引入 Payments 表:
这样将来您可以轻松添加其他付款类型,例如添加:
另外,我我假设可以为多个订阅收取一笔费用。
Your database design should consider what types of queries you will want to execute against the data, however, without knowing more, how about introducing a Payments table:
This way in the future you can easily add other payment types, e.g. add:
Also, I'm assuming a payment can be taken for more than one subscription.