Hi,
I am just about to embark on my first rails project. I am going to be
using Aptana IDE and MySQL and SVN to manage my code. I have been
thinking about how to structure my database and would like some
pointers.
This is what I am trying to acheive; I would like to create a load of
businesses, those businesses can have more than one contact, the
business will also be categorised and sub-categorisd (I am thinking
tagging might be a better option, but lets start with categories) and
can also have a number of photos. A contact can also have a photo.
So far this is how I have structured it:
Table - business
id
name
address
city
post_code
tel
fax
email
website
description
notes
Table - contacts
id
first_name
surname
address
city
post_code
tel
fax
email
website
business_id
Table - photos
id
caption
business_id
contact_id
Table - categories
id
name
business_id
Table - sub_categories
id
name
business_id
Table - cities
id
name
business_id
contact_id
That’s my schema!
Should a contact have many businesses or should a business have many
contacts? Which way round should I be thinking of these things? Or does
either way work. Should a photo have many businesses or should a
business have many photos? etc… These are things that I don’t know the
answers to when designing my database.
Any suggestions or comments please, this is my first rails project and
my first ever database, many thanks.