fix script

master
Benjamin Schieder 2017-04-26 09:29:51 +02:00
parent 8aa2cddb78
commit 3cfcef2ee6
1 changed files with 1 additions and 3 deletions

View File

@ -27,16 +27,14 @@ binmode STDOUT, ":utf8";
my @migrations = glob ("migrations/*sql"); my @migrations = glob ("migrations/*sql");
foreach my $migration (@migrations){ foreach my $migration (@migrations){
my $sth = RSSTootalizer::DB->doSELECT("SELECT * FROM migrations WHERE name = ?", $migration); my $sth = RSSTootalizer::DB->doSELECT("SELECT * FROM migrations WHERE name = ?", $migration);
if (!$sth){ if (scalar(@$sth) == 0){
print "Running migration $migration\n"; print "Running migration $migration\n";
open (M, "<", $migration); open (M, "<", $migration);
my $sql = ""; my $sql = "";
while (<M>){ while (<M>){
chomp; chomp;
print "Read: $_\n";
$sql .= $_; $sql .= $_;
if ($sql =~ /;/){ if ($sql =~ /;/){
print "Running: $sql\n";
RSSTootalizer::DB->doDELETE($sql); # Using doDELETE for lack of error handling... RSSTootalizer::DB->doDELETE($sql); # Using doDELETE for lack of error handling...
$sql = ""; $sql = "";
} }