File::Slurp -> File::Slurper

This commit is contained in:
Graham Christensen
2021-09-06 21:44:46 -04:00
parent c54629b732
commit c880888f1e
9 changed files with 10 additions and 14 deletions

View File

@@ -5,7 +5,7 @@ use warnings;
use Hydra::Schema;
use Hydra::Helper::Nix;
use Hydra::Model::DB;
use File::Slurp;
use File::Slurper qw(read_text);
use SQL::SplitStatement;
use List::Util qw(max);
@@ -25,7 +25,7 @@ my $maxSchemaVersion = max (map { /.*\/upgrade-(\d.*)\.sql/; $1 } (glob "$home/s
my @tables = $dbh->tables;
if (! grep { /SchemaVersion/i } @tables) {
print STDERR "initialising the Hydra database schema...\n";
my $schema = read_file(
my $schema = read_text(
$dbh->{Driver}->{Name} eq 'Pg' ? "$home/sql/hydra.sql" :
die "unsupported database type $dbh->{Driver}->{Name}\n");
my @statements = $sql_splitter->split($schema);
@@ -58,7 +58,7 @@ QUOTE
for (my $n = $schemaVersion; $n < $maxSchemaVersion; $n++) {
my $m = $n + 1;
print STDERR "upgrading Hydra schema from version $n to $m\n";
my $schema = read_file("$home/sql/upgrade-$m.sql");
my $schema = read_text("$home/sql/upgrade-$m.sql");
my @statements = $sql_splitter->split($schema);
eval {
$dbh->begin_work;