[Dbix-class] Adding an additional custom join parameter

Andrew Beverley andy at andybev.com
Tue Dec 10 11:36:38 GMT 2013


On Tue, 2013-12-10 at 19:42 +0900, Hailin Hu wrote:
> Can I ask why you need site_task table?
> In relationship view, it is the same as issue table.

That's a good question. The reason is that "issues" will often be
generated that are not related to a "task", and likewise there will be
"tasks" that are related to "sites" but that do not have any "issue" to
link them (in which case the "site_task" table would be used).

> It is something like that you defined one many-to-many relation (task
> <-> site) through two bridge tables (site_task and issue).

You raise a valid point though, in that this is probably a poor way to
design such a database. Maybe I should only have one "site_task" table
to link the "sites" and "tasks" tables, and then have appropriate fields
within that single table to signify whether the entry is linking the 2
tables for reason of an "issue" or a "task".

http://files.andybev.com/schema.png

Thanks,

Andy





More information about the DBIx-Class mailing list