[Dbix-class] Schema design query

Rob Kinyon rob.kinyon at gmail.com
Wed Feb 25 22:55:52 GMT 2009


On Wed, Feb 25, 2009 at 15:58, Dermot <paikkos at googlemail.com> wrote:
> Hi,
>
> I am trying to design a schema and I could use some ideas as I'm not
> confident about the best way forward.
>
> I have a table of entities. Each entity is to belong to at least one
> or more of 7 different categories. The requirement is to retrieve
> entities by category. As far as I can tell, I either include a new
> field in the entities table (is_cat1, is_cat2...etc) or I create one,
> or possibly, more join tables on the entities and their category. The
> other issue is that user's search the entities table via a web
> front-end search facility (not from the DB) that returns the entity
> id,  so I am trying to find a structure that, given a entity_id, can
> be filtered on relationship to the categories.

The "solution" is to use a many-to-many relationship. This is
well-supported by DBIC.

Rob



More information about the DBIx-Class mailing list