Was trying to generate the Perl module DBIx::Class schema files from a database using DBIx::Class::Schema::Loader. Using the example on the CPAN page for DBIx::Class::Schema::Loader the following error came up.
Unable to load schema – chosen moniker/class naming style results in moniker clashes. Either change the naming style, or supply an explicit moniker_map: tables ‘dm_pp_hn’, ‘dm_pp_hns’ reduced to the same source moniker ‘DmPpHn’
The table names were obviously very similar and causing a problem when generating the schema. Additional information could be found in: DBIx::Class::Schema::Loader::Base
Basically changed the code from:
#!/usr/bin/perl
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
make_schema_at(
‘dbname::Schema’,
{ debug => 1,
dump_directory => ‘./Schema’,
},
[ 'dbi:mysql:dbname=dbname', 'user', 'pass',
# { loader_class => 'MyLoader' } # optionally
],
);
To:
#!/usr/bin/perl
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
make_schema_at(
‘dbname::Schema’,
{ debug => 1,
dump_directory => ‘./Schema’,
moniker_map => { ‘dm_pp_hn’ => ‘DmPpHn’,
‘dm_pp_hns’ => ‘DmPpHnS’,
},
},
[ 'dbi:mysql:dbname=dbname', 'user', 'pass',
# { loader_class => 'MyLoader' } # optionally
],
);
And the schema was dumped successfully.
0 responses so far ↓
There are no comments yet...
Leave a Comment