If tables in a MySQL database have names in plural (say, "test_items"), corresponding result classes generated by the initial run of rapidapp.pl in MyApp/DB/Result will also have names in plural: TestItems.pm. However, subsequent runs of devel/model_DB_updater.pl will generate classes with names in singular: TestItem.pm.
As far as I can tell, this happens because the default behavior (changing table names to singular) gets replaced in Catalyst::Helper::Model::DBIC::Schema::ForRapidDbic:
$loader_args->{moniker_map} = sub {
my $table = shift; $table =~ s{\+$}{_plus};
join '', map ucfirst, split /[\W_]+/, lc $table
};
The docs for DBIx::Class::Schema::Loader::Base may give some hint to a solution: a coderef assigned to moniker_map accepts 3 arguments:
the DBIx::Class::Schema::Loader::Table object for the table
the default moniker that DBIC would ordinarily give this table
a coderef that can be called with either of the hashref forms to get the moniker mapped accordingly.
so that we can possibly get the default moniker and apply further processing to it and not to the original table name (not tested).
If tables in a MySQL database have names in plural (say, "test_items"), corresponding result classes generated by the initial run of rapidapp.pl in MyApp/DB/Result will also have names in plural:
TestItems.pm
. However, subsequent runs of devel/model_DB_updater.pl will generate classes with names in singular:TestItem.pm
.As far as I can tell, this happens because the default behavior (changing table names to singular) gets replaced in Catalyst::Helper::Model::DBIC::Schema::ForRapidDbic:
The docs for DBIx::Class::Schema::Loader::Base may give some hint to a solution: a coderef assigned to moniker_map accepts 3 arguments:
so that we can possibly get the default moniker and apply further processing to it and not to the original table name (not tested).