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.
TJK27WSBFOM6LKVCSA7LTTCWUGB4O2AL22PNIDQXS4BFOFCISH2QC
VPEQI5QSRW23ETE7CCMKIKIB25J5PUAPVG43HAMUIOGA2KMXLULQC
JH4RYUNGSWDSDRVNY3B7N6MCEGJBYDZW4RHBWGCMAF7S3UEOKVWAC
AMFMXR52JXHUOWWG4VZ5DHQGLF4F7H7XSJRLX5XNEXOCCWYLDQOAC
HPEG2RHVNHOPB5T4ZRXANIRBMVOVY3B5GFETJRYOTDJFVAYH2TQAC
7DWCXNC72OO3M4YGNVV4KM775CUSPBHEFFNMRIA2XAZTQCXYHBRQC
OOQ2D3KCLFPYNAN253PHWLBQMB6OMO2KYQWQXLTP65SQAYZWQ5LAC
C7CXMZ66BZTI5ABDJNPL2JKSHSKDQ645GXUKN7OTQBPEQJ452KQAC
QBQSQOSYZLHDZ65RLOFEWFAIKHA5UN7V4RQYVXHCWUJDDXXGOZFQC
T7Z63K6TE3H5XDKFW5MPFTI33WK42ZXYGHMAM3WJLMGYMQN4HMIAC
AFTXA575C6JTVLVXTYJUKQGPLBO3NFORLO5XDSPHNL44HXLRH4TAC
2GK5DOU7ODF4WBSN3QTD3WIO52VTL2LOAXKGCDEMMAQPTEO4A4HAC
IN272KZWHENW2TCR3LWQ6OZAEESJL5S7AEL3GYLJTWHJUDE6HADAC
A63IHCMXH3F4V56HDXJLJVVHKXRSJCJMT2PWXXI2IW3J734J6SGQC
IDFJXJHWHW62KP737BN7QETCBSDT5PJIR6226I5BFRA4VN2BOGSAC
RBGYFVWXQNXAZ57534WQQJH6PYW7PU6YZLSCLXDZYXACXDA2D3NQC
YJKSGJPCSG4R2A4OHJALD3MVMOVAKX6XM6R3U2DSJ5T2ELU4SG3QC
W3HI52QVYQUEMJDK6TI54WPNDQJOHYD47G45LNMI2YTH6YGKNXNQC
VKOHKP4MCR2PYJQCY34J4CMEXLUECS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DR77SHWADKDCPIS2INMTPTIVAC
SJN2QPWHFYKX7CJMW4XZHI2P2THH7MECZZIHQMCH6EKBZ45G3DOAC
RAKTHYAIX757GPYWCHOE5H5RD3QYKQW3QKLWUIUKPHQ5QGWQXWQQC
5SHCWE7XPQORSOLY7HGAIK2ODKBFPY4KVXRL2W7X6D4WALU544HQC
ZWCTAZGLJZQNTYWTC2XQUKMILJF6JGDL5IND6QNYWK4FIGMLRFXAC
IW2LHCLLCFC6CSM5BECJS3PN2LPBAM4ZJX6NHBZPIRUJTNWHG4EAC
TULPZ62YXEHXUWGBZMLCLYILEXPQS5ADPT22574BIRFU4CZMBSKAC
6KCP6ODPUDLR2VLWE6LAULMYKI3TWQYEQYZRTYQ4WQX2A5RT6XRQC
N22GPKYTOLZLBGTGDATQDVZ4R5APZEAOIA7L32X4UXBH4XNI7MWAC
RWIBJ5L4MDV4XQIQXBB45RBVAK2IAK3IMP37YUX2SHW7YDKDAAXAC
IJPTEKRF3R2HDCUFK3TCVCVVLSF6JSO57RY4DRX3RQPIGOWDB2TQC
WZ3AEJ67LOG5L335AAC2BDLIJPIU4VSCGBMATBHDZC26ECRS5A6AC
4X6NS66QDWR4S4ZZFKN2QOJQII5ZYIMTDYRHK25N6NJSROVLHJ6QC
ONAQU4BRGYO6MGPGIQIK5KF4JE4TBJMFFBU5XBKFTYQ5RPW7FOYQC
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"};
if ( defined $db ) {
return $db ;
}
else {
my $path = getHydraPath . '/hydra.sqlite';
die "The Hydra database ($path) not exist!\n" unless -f $path;
return "dbi:SQLite:$path";
}
}
sub openHydraDB {
my $db = Hydra::Schema->connect(getHydraDBPath, "", "", {});
$db->storage->dbh->do("PRAGMA synchronous = OFF;")
if defined $ENV{'HYDRA_NO_FSYNC'};
return $db;
}
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";
}
use Hydra::Helper::Nix;
sub addSequence {
my $hydradbi = getHydraDBPath ;
if ($hydradbi =~ m/^dbi:Pg/) {
__PACKAGE__->sequence('builds_id_seq');
}
}
addSequence ;
sub addSequence {
my $hydradbi = getHydraDBPath;
if ($hydradbi =~ m/^dbi:Pg/) {
__PACKAGE__->sequence('builds_id_seq');
}
}