Open the DB using Hydra::Model::DB->new
This gets rid of the openHydraDB function and ensures that we open the database in a consistent way. Also drop the PostgreSQL sequence hacks. They don't seem to be necessary anymore.
This commit is contained in:
@ -2,7 +2,20 @@ package Hydra::Model::DB;
|
||||
|
||||
use strict;
|
||||
use base 'Catalyst::Model::DBIC::Schema';
|
||||
use Hydra::Helper::Nix;
|
||||
|
||||
sub getHydraPath {
|
||||
my $dir = $ENV{"HYDRA_DATA"} || "/var/lib/hydra";
|
||||
die "The HYDRA_DATA directory ($dir) does not exist!\n" unless -d $dir;
|
||||
return $dir;
|
||||
}
|
||||
|
||||
sub getHydraDBPath {
|
||||
my $db = $ENV{"HYDRA_DBI"};
|
||||
return $db if defined $db;
|
||||
my $path = getHydraPath . '/hydra.sqlite';
|
||||
die "The Hydra database ($path) not exist!\n" unless -f $path;
|
||||
return "dbi:SQLite:$path";
|
||||
}
|
||||
|
||||
__PACKAGE__->config(
|
||||
schema_class => 'Hydra::Schema',
|
||||
|
Reference in New Issue
Block a user