Jump to content

DB design question


KevinM1

Recommended Posts

I'm currently working on a game review site, and have hit a small snag with my db design.  A lot of games are offered on multiple platforms, for example, the Grand Theft Auto series - the main games are available on PS3, XBOX 360, and the PC.  I'm just wondering how I should model that, as right now I have a sketch that looks like:

 

table reviews(
id unsigned int not null auto-increment primary key,
title varchar(45) not null,
permalink varchar(45) not null,
content text not null,
genre_id unsigned int not null foreign key (genres)
)

 

I'm just not sure how to properly tie the platform info to the reviews.  Maybe a pivot table linking games to platforms?

Link to comment
https://forums.phpfreaks.com/topic/195592-db-design-question/
Share on other sites

table reviews(
id unsigned int not null auto-increment primary key,
title varchar(45) not null,
permalink varchar(45) not null,
content text not null,
genre_id unsigned int not null foreign key (genres)
platform_id unsigned int not null foreign key (platforms)
)

table platforms(
id auto_inc primary,
platform varchar(45)

 

Would be what I would do.

 

EDIT:

If you have a games table, that would be the spot to put the platform_id or the pivot table. Either or should work.

Link to comment
https://forums.phpfreaks.com/topic/195592-db-design-question/#findComment-1027740
Share on other sites

That's definitely an idea, but I was hoping to not have a separate review for the same game on multiple platforms.  Of course, I could always have a platforms_reviews pivot table...  hmm.

 

You would not "have" to have a review for the same game on multi-platforms. necessarily. You could if you want, but instead you could just do "Reviewed on Platform" then just do not link the reviews via category wise to a platform, if that makes sense...

Link to comment
https://forums.phpfreaks.com/topic/195592-db-design-question/#findComment-1027752
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.