Saturday, March 19, 2011

Re: what naming convention for three-way joining table?

On Mar 19, 4:52 pm, "Mariano C." <mariano.calan...@gmail.com> wrote:
> I'm developing a project about little soccer league. I need to store
> teams, team's players, matches info (which are two teams involved in
> the match), events (various events happened douring a single match -
> goal, penalty, red card, yellow card etc etc-)
>
> This is the DB realized (only PK and FK are shown):http://www.freeimgshost.com/viewer.php?file=pi93lbvdrje2iup9cw8.jpg

I waited 60s for an image which didn't appear before concluding you've
chosen the worst possible place to put what is essentially textual
information (your db schema).

TIp: if you want people to help you make it EASY for them to do so.

>
> What do you think? Is designed correctly.
> It seems correct my question is about naming convention.

I'd recommend asking such questions in an appropriate place - like a
db group/irc channel.

>
> I'm pretty confused about name: teams_matches (better matches_teams I
> suppose), players_teams_matches (better matches_teams_players), and
> events are these correct???

Doubt it - why are all your tables named like they are join tables - a
table with more than 2 fields is a model. What does
matches_teams_players represent? That a player took part in a match?
Remember you're going to be typing these model names througout your
app and PlayersTeamsMatches is going to get tiresome (and irritating
e.g. or was it TeamsPlayersMatches or MatchesPlayersTeams?). Why not
give it a name which means something to you, such as

match_players
id
team_id
player_id
match_id
position
anything else you want

> What about teams_match_id foreign key?

Who knows...

>
> How many models I need to create?

How many tables do you need which are not join tables? that's your
golden number ;)

AD

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate