EllisLab text mark
Advanced Search
     
Proper relationship definition
Posted: 21 November 2009 03:39 PM
Avatar
Joined: 2006-09-30
284 posts

Alright - my head hurts. Someone help me figure out how to set this up.

I have 3 tables: plants, images and plant_images

- One plant can have many (0-n) images
- Each image though, really ever has one plant

The images table is generic. It’s not only bound to plants. It just hold information about the image resources and has images that have nothing to do with plants at all. So I guess plant_images is not really a n:n relationship but really 1:n relationship to plants. But it’s also a 1:1 relation ship with images (if one exists).

I need some suggestion on how to set up the models for this and how to maintain the records in the plant_images table as it should change when I add/remove plants as well when I add/remove images (for a plant).

Any help would be much, much appreciated.

Regards,
m

 Signature 

sitesquad.net | < insert catchy tagline here />

 
Posted: 21 November 2009 04:35 PM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2006-09-30
284 posts

Sorry all - this was supposed to go to the DMZ thread. I’ll repost there. Please ignore.

 Signature 

sitesquad.net | < insert catchy tagline here />