many-to-many table convention

1,382 views
Skip to first unread message

Yannick

unread,
Oct 25, 2010, 7:11:20 PM10/25/10
to ColdFusion on Wheels
I've look at the naming convention for database (http://cfwheels.org/
docs/1-0/chapter/conventions) but have not found anything on many-to-
many relation.

So for every many-to-many we use a junction table so my question is
how should I name it.

The many-to-many is between my tables "actions" and "members".

Thanks.

Alan Rother

unread,
Oct 25, 2010, 7:31:05 PM10/25/10
to cfwh...@googlegroups.com
I have this same issue, I would love to see a good example.


=]


--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To post to this group, send email to cfwh...@googlegroups.com.
To unsubscribe from this group, send email to cfwheels+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cfwheels?hl=en.




--
Alan Rother
Manager, Phoenix Cold Fusion User Group, www.AZCFUG.org
Twitter: @AlanRother


Andy Bellenie

unread,
Oct 25, 2010, 7:47:35 PM10/25/10
to cfwh...@googlegroups.com
Best practice is to consider them as real world models rather than a db tool, so a join between a subscriber and a publication is a subscription. If something like that isn't immediately obvious then I usually find myself naming them by combining their parents like userGroups or fieldsetFields etc


If possible try to tre your many-many relationships 

Sent from my iPhone

Yannick

unread,
Oct 25, 2010, 9:25:56 PM10/25/10
to cfwh...@googlegroups.com
Thanks Andy,

from Ruby and Rails Naming Conventions they have the following:

Many to Many Link Tables
Tables used to join two tables in a many to many relationship is named using the table names they link, with the table names in alphabetical order, for example items_orders.
Yannick Morin
Co-founder of bizonbytes.com

Yannick

unread,
Oct 25, 2010, 9:51:48 PM10/25/10
to cfwh...@googlegroups.com
also I've notice that cfwheels name the FK regionid and rails use the underscore region_id.

So should I name it actionsmembers or actions_members I just want to follow the cfwheels convention.

Chris Peters

unread,
Oct 25, 2010, 9:56:43 PM10/25/10
to cfwh...@googlegroups.com
To keep things consistent, I recommend actionsmembers. You can reference it in the model function as model("actionsMember").
Reply all
Reply to author
Forward
0 new messages