Forum: Ruby on Rails datamodell/databasestructure

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ce34231704c79be57af51f19efca5fa4?d=identicon&s=25 Tobias Bender (Guest)
on 2006-04-12 14:13
(Received via mailing list)
Hi.

I am trying to develop a small utility to manage inventories for
outdoor-journeys

At the moment I have the following tables to show a many_to_many-
relationship between items(like tents/sleepingbags) and users:

items	<->		holdings(join)	<-> 		users
------------------------------------------------------------------------
--------------------------------------
id				user_id					id
name 			item_id					name
...				number					password
				id						......

Now i want to expand my model with journeys .

A journey should have many users and many users should have many
journeys. That will result in the following tables:

journeys 	<->	journeys_users	<-> 		users
------------------------------------------------------------------------
--------------------------------------
id				journey_id					id
name 			item_id					name
...										password
										......
Here is my problem:

I now want to relate inventory(holdings) to journeys, so that i can
show how many tents/sleepingbacks are carried in one journey.

Whats the most effective way doing this?

	* should i expand the holdings table with a journey_id-column     OR
	* should i create a new table journeys_holdings with journey_id and
holding_id as column?

Thanks in advance,
	Tobias
This topic is locked and can not be replied to.