[Catalyst] Setting rel_collision_map in myapp_create.pl

Greg Matheson drbean at freeshell.org
Fri Feb 10 04:32:52 GMT 2012


On Thu, 09 Feb 2012, Robert Rothenberg wrote:

> The application that I am working on uses myapp_create.pl to create the
> model from the database schema.

> The problem is that the DBIx::Schema::Loader is creating a relationship with
> a name that is inappropriate, and conflicts with a relationship that I've
> manually created.

tl;dr

Perhaps DBIx::Schema::Loader::Base will help.

   moniker_map
       Overrides the default table name to moniker translation.  ...

       The default behavior is to split on case transition and non-alphanumeric
       boundaries, ..


           Table Name       | Moniker Name
           ---------------------------------
           luser            | Luser

Using dbicdump, perhaps:

dbicdump -o dump_directory=./loader -o moniker_map='{round=>"Round",rounds=>"Rounds"}' Tennis::Schema dbi:Pg:dbname=tennis002 '' ''

> In this case, there is a table of "group", "employee" and a third table
> "employee_group" that links employees to groups. The group table has a
> "leader" field that references an employee who is the group leader. DBIC has
> decided to create a relationship on players called "groups" that basically
> says what groups the employee is the leader of.  Not a very good name, and
> of course conflicts with the "groups" relationship that I created, that
> indicates what groups an employee is actually in. (Yes, there is an
> "employee_groups" relation, but I added the "groups" relation to bridge that
> indirection.)

> Looking at the documentation for DBIx::Schema::Loader, there is an option
> called rel_collision_map that can supposedly be used to fix this. I'm unsure
> how it works, and even less sure how to pass a hash as an option to the
> myapp_create.pl script.

> If that option is supported, examples would be helpful.

> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/



More information about the Catalyst mailing list