./script/myapp_create.pl model DB Adaptor MyApp::Schema connection
package MyApp::Web::Model::DB;
use strict;
use warnings;
use base 'Catalyst::Model::Adaptor';
__PACKAGE__->config(
class => 'MyApp::Schema',
constructor => 'connection',
);
sub prepare_arguments {
my ( $self, $app ) = @_;
my $args = $app->config->{"Model::DB"}->{args};
return $args;
}
sub mangle_arguments {
my ( $self, $args ) = @_;
return @$args;
}
on myapp.yml
Model::DB:
args:
- dbi:Pg:dbname=myapp_db
- myapp_user
- myapp_pass
-
AutoCommit: 0
No comments:
Post a Comment