Branch Coverage

blib/lib/SQL/Schema/Versioned.pm
Criterion Covered Total %
branch 99 154 64.2


line true false branch
22 0 24 unless $comp =~ /\A\w+\z/
25 11 13 $comp eq 'main' ? :
33 29 2 if ($sql =~ /\A\s*
57 0 16 unless my($provcomp, $provver) = $row[1] =~ /\A(\w+):(\d*)\z/
280 1 0 &Scalar::Util::Numeric::isint($args{'create_from_version'}) ? :
1 0 defined $args{'create_from_version'} ? :
1 0 if defined $args{'create_from_version'} ? 1 : ($arg_err //= 'Required but not specified', 0)
0 1 if ($arg_err)
1 23 if (exists $args{'create_from_version'})
24 0 &Scalar::Util::blessed($args{'dbh'}) ? :
24 0 defined $args{'dbh'} ? :
24 0 if defined $args{'dbh'} ? 1 : ($arg_err //= 'Required but not specified', 0)
0 24 if ($arg_err)
24 0 if (exists $args{'dbh'})
0 24 unless (exists $args{'dbh'})
24 0 ref $args{'spec'} eq 'HASH' ? :
24 0 defined $args{'spec'} ? :
24 0 if defined $args{'spec'} ? 1 : ($arg_err //= 'Required but not specified', 0)
0 24 if ($arg_err)
24 0 if (exists $args{'spec'})
0 24 unless (exists $args{'spec'})
297 9 15 if (@has_meta_table)
304 9 15 if (@has_meta_table)
312 2 22 if ($spec->{'provides'}) { }
17 5 elsif ($spec->{'install'}) { }
318 1 4 if ($comp ne 'main')
329 20 3 unless my $deps = $spec->{'deps'}
334 1 2 unless defined $prov
343 1 1 unless $provver >= $reqver
358 18 7 unless $prov
360 1 6 unless $provcomp eq $comp
377 0 20 unless (defined $latest_v)
380 0 0 unless /^upgrade_to_v(\d+)$/
381 0 0 if $1 > $latest_v
385 1 19 if ($current_v > $latest_v)
395 1 5 unless $prov->[0] eq $comp
399 3 13 if (@k)
401 0 3 unless $dbh->do('DELETE FROM meta WHERE name IN (' . join(',', map({$dbh->quote($_);} @k)) . ')')
406 0 22 unless $dbh->do('INSERT INTO meta (name, value) VALUES (?, ?)', {}, "table.$t", "${comp}:$latest_v")
417 4 2 $comp eq 'main' ? :
422 6 0 if $cur_summary eq $new_summary
423 0 0 unless $dbh->do('REPLACE INTO meta (name, value) VALUES (?, ?)', {}, $key, $new_summary)
439 6 25 if $current_v >= $latest_v
449 15 10 if ($current_v == 0)
451 14 1 unless (@has_meta_table)
453 0 14 unless ($dbh->do('CREATE TABLE meta (name VARCHAR(64) NOT NULL PRIMARY KEY, value VARCHAR(255))'))
456 15 0 unless ($sv_row)
458 0 15 unless ($dbh->do("INSERT INTO meta (name,value) VALUES ('${sv_key}',0)"))
461 1 14 if ($from_v) { }
463 1 0 if ($$spec{"install_v$from_v"}) { }
468 0 3 if (ref $step eq 'CODE') { }
469 0 0 if ($@)
471 0 3 unless ($dbh->do($step))
476 0 1 unless ($dbh->do("UPDATE meta SET value=$from_v WHERE name='${sv_key}'"))
478 0 1 if ($current_v == $latest_v)
479 0 0 if (my $up_res = &$code_update_provides())
482 0 1 unless ($dbh->commit)
492 10 4 if ($spec->{'install'}) { }
4 0 elsif ($spec->{'upgrade_to_v1'}) { }
497 1 14 if (ref $step eq 'CODE') { }
498 0 1 if ($@)
500 0 14 unless ($dbh->do($step))
504 0 10 unless ($dbh->do("UPDATE meta SET value=$latest_v WHERE name='${sv_key}'"))
506 0 10 if (my $up_res = &$code_update_provides())
508 0 10 unless ($dbh->commit)
527 0 14 unless ($$spec{"upgrade_to_v$next_v"})
531 1 24 if (ref $step eq 'CODE') { }
532 1 0 if ($@)
534 2 22 unless ($dbh->do($step))
539 0 11 unless ($dbh->do("UPDATE meta SET value=$next_v WHERE name='${sv_key}'"))
541 6 5 if ($current_v == $latest_v)
542 0 6 if (my $up_res = &$code_update_provides())
543 0 6 if (my $us_res = &$code_update_summary())
546 0 11 unless ($dbh->commit)
553 3 16 if ($res->[0] != 200) { }
555 3 0 unless $db_state eq 'committed'
557 0 16 unless $db_state eq 'committed'