设置我的画廊表格
我将为图片库创建一个网络应用程序。
这就是我创建数据库表的方式。 (我已经排除了其余不必要的表。)
Gallery Gid -> Primary key. Rid -> Foreign key from register table. Name -> Name of the image. Url -> Location of image. Status -> Enabled or disabled. Album Aid -> Primary key. Name -> Name of the album. Imagelist Iid -> Primary key. Aid -> Foreign key from Album table. Gid -> Foreign key from Gallery table.
但由于某种原因,我觉得这些表的结构是错误的。我的要求是用户应该能够从图库表创建不同的相册。
例如,如果有名为 A、B、C、D 的图片,那么用户应该能够创建名为 a1 的相册,其中包含图片 A、B、C;相册a2包含图片A、B、D。
我创建了这三个表,但我感觉表结构有问题。有人能指出我正确的方向吗?
I am going to create a web application for picture gallery.
So this is how I have created my database tables. (I have excluded the rest of unnecessary tables.)
Gallery Gid -> Primary key. Rid -> Foreign key from register table. Name -> Name of the image. Url -> Location of image. Status -> Enabled or disabled. Album Aid -> Primary key. Name -> Name of the album. Imagelist Iid -> Primary key. Aid -> Foreign key from Album table. Gid -> Foreign key from Gallery table.
But for some reason I feel the structure of these tables are wrong. My requirement is user should be able to create different albums from the gallery table.
For example if there are pictures named A, B, C, D. then user should be able to create album named a1 which contains pictures A,B,C; album a2 which contains pictures A, B, D.
I have created this three tables, but I feel that there is something wrong in the table structure. Can someone point me in a right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不会将带有图像的表格称为画廊,因为它可能意味着相册。从我的角度来看,数据库模式是正确的,我唯一要更改的是 ImageList 表,因为那里不需要 Iid,Aid 和 Gid 应该是唯一索引,我还会添加字段来存储相册中的图像顺序,并设置所有表到InnoDB模式。
这是数据库架构的示例:
I would not call table with images a gallery as it can mean album to. From my point of view database schema is correct only thing I would change is ImageList table as Iid is not required there, Aid and Gid suppose to be unique index, I would also add field to store image order in album, and also set all tables to InnoDB mode.
Here is example of database schema: