正确的 MySQL 数据库结构
我正在为当地餐馆目录开发一个网络管理面板。他们的旧系统非常笨重,如果不修改一堆代码就无法扩展。
当前的数据库结构如下:
table: Restaurants
cols: id, restname, preferred, image, phone, address, website, vip_special
该表就列而言是静态的。
table: Locations
cols: id, restname, downtown, bluffton, tybee, pooler, etc...
table: Cuisines
cols: id, restname, american, chinese, seafood, bar_tavern, etc...
table: Ambiances
cols: id, restname, outdoor_dining, fine_dining, waterfront, rooftop, romantic, etc...
后 3 个表要求开发人员进入并为每个新位置、美食或氛围添加一个新列,并更改代码以反映这些新列。
在 DBA 方面,我并不是最优秀的,所以我很好奇对于这种情况最好的结构是什么。
关联:一家餐厅可以有多个地点、菜肴和氛围,
谢谢大家的帮助。
I'm developing a web administration panel for a local restaurant directory. Their old system is very clunky and not able to expand without modifying a bunch of code.
The current DB structure is like this:
table: Restaurants
cols: id, restname, preferred, image, phone, address, website, vip_special
This table is static as far as columns go.
table: Locations
cols: id, restname, downtown, bluffton, tybee, pooler, etc...
table: Cuisines
cols: id, restname, american, chinese, seafood, bar_tavern, etc...
table: Ambiances
cols: id, restname, outdoor_dining, fine_dining, waterfront, rooftop, romantic, etc...
The latter 3 tables require a developer to go in and add a new column for each new location, cuisine, or ambiance as well as change the code to reflect those new columns.
I'm not the greatest when it comes to DBA so I was curious as to what the best structure would be to this situation.
Associations: A restaurant can have several locations, cuisines, and ambiances
Thank you all for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里的起始
标签类型可以是枚举,如果您有一些不会改变的类型,您可以删除类型表。
我不确定您是否想将一家餐厅分配到多个地点,因为即使它们可能是连锁店,氛围也可能会有所不同,菜单可能会提供不同的美食
Here's a start
Tag type could be an enum if you have a few types that won't change you can drop the type table.
I'm not sure if you want to assign one restaurant multiple locations as, even though they might be a chain, the ambiance might be different and the menu might offer different cuisines