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