On 9/5/06, TWIOF <[EMAIL PROTECTED]> wrote: > I know I could break it up into a separate listings table for each type > but I'd like to be able to add types with out having to make a new > table each time.
Based on what you describe, I would suggest a "places" table, which has a type attribute. Type can contain "club", "bar" or "gig". Introducing a new place type is easy. Introduce a FK between places and listings. However, if you store fundamentally different attributes for each type of place, it might be a valid design decision to store them in 3 different tables. It is no problem to have 3 FK's in the listings-table - FK's can be optional, so you just add 3 FK's to your listings-table. The constraint that "one and only one of 3 FK's must be filled" can not be expressed in the database (at least, not in MySQL - check constraints are not supported). You could put the constraint that "one and only one of the three FK's must be filled" in your Cake-model. I'm not too proficient with Cake yet to give you an example, but there are plenty other helpful people around here which should be able to help out. Martin -- Martin Schapendonk, [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---
