Erlang Mailing Lists

Author Message

<  Erlyweb mailing list  ~  2-to-many relationship in ErlyWeb

ettore
Posted: Wed May 13, 2009 6:46 am Reply with quote
Joined: 13 May 2009 Posts: 5
I am using ErlyWeb for my chess application. I have a very simple DB representing a chess game/player scenario:

Player table: {id, name, score, etc}
Game table: {id, white_id, black_id}

As you can see there is strictly a 2-to-many relationship so the easiest way to handle this is having 2 foreign keys (white and black players) exist in the Game table. I am aware my foreign key should be named "player_id" but in this case it obviously can't work as I would have 2 foreign keys with the same name.

I am also aware that as per the ErlyWeb docs I "should" represent this as a many-to-many relationship (so adding a relation table), but this would be a complication in the DB needed only to satisfy a ErlyWeb requirement. Is there a way to avoid the requirement of having a relation table and just use the nice (and most natural) DB structure I wrote above and so make ErlyDB see the relation?

Thanks in advance.
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum