Conform to change of database name.

This commit is contained in:
barnold 2022-10-10 12:50:11 +01:00
parent dde8343978
commit 390850ec75
1 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,6 @@ use Moose;
use Moose::Util::TypeConstraints;
use Mojo::Log;
use Book::Schema;
use List::Util qw( max min );
no warnings qw( experimental::signatures );
# Keep rows-per-page within a somewhat-sane range.
@ -19,6 +18,7 @@ has 'rows_per_page' => (
default => 20,
);
our $dbname = "pg_book_catalog";
our $logger = Mojo::Log->new;
# Share this among all model instances.
@ -26,8 +26,8 @@ our $schema;
sub schema ($self) {
if (!defined $schema) {
$logger->info("Connecting to database.");
$schema = Book::Schema->connect('dbi:Pg:');
$logger->info("Connecting to database $dbname.");
$schema = Book::Schema->connect("dbi:Pg:dbname=$dbname");
}
return $schema;
}