hydra-init: show SQL commands being executed
[?]
Apr 15, 2012, 4:34 PM
32MXC7NNZKN5KFZNMS6J22LHLL4WQJFKTWHBKAJVDM6NBORIKAEACDependencies
- [2]
AMFMXR52Provide a command ‘hydra-init’ to initialise/upgrade the database - [3]
TJK27WSBOpen the DB using Hydra::Model::DB->new
Change contents
- replacement in src/script/hydra-init at line 28
$dbh->{Driver}->{Name} eq 'SQLite' ? "$home/sql/hydra-sqlite.sql" :$dbh->{Driver}->{Name} eq 'Pg' ? "$home/sql/hydra-postgresql.sql" :die "unsupported database type\n");$dbh->{Driver}->{Name} eq 'SQLite' ? "$home/sql/hydra-sqlite.sql" :$dbh->{Driver}->{Name} eq 'Pg' ? "$home/sql/hydra-postgresql.sql" :die "unsupported database type\n"); - replacement in src/script/hydra-init at line 33
$dbh->begin_work;$dbh->do($_) foreach @statements;$db->resultset('SchemaVersion')->create({version => $maxSchemaVersion});$dbh->commit;$dbh->begin_work;$dbh->do($_) foreach @statements;$db->resultset('SchemaVersion')->create({version => $maxSchemaVersion});$dbh->commit; - replacement in src/script/hydra-init at line 53
$dbh->begin_work;$dbh->do($_) foreach @statements;$db->resultset('SchemaVersion')->update({version => $m});$dbh->commit;$dbh->begin_work;sub run {my ($stm) = @_;print STDERR "executing SQL statement: $stm\n";$dbh->do($_);}run($_) foreach @statements;$db->resultset('SchemaVersion')->update({version => $m});$dbh->commit;