Skip to content

Commit

Permalink
execute post-slony shaping SQL DDL / DCL commands at the end of stage…
Browse files Browse the repository at this point in the history
… 1 and 3 .slonik files

TODO: need to collect sql_stage1_file names from diff_doc() if there is
more than one as a result of many changes between definition files
  • Loading branch information
nkiraly committed Jul 7, 2015
1 parent 2a27bdb commit dde6d5b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/DBSteward/sql_format/pgsql8/pgsql8.php
Original file line number Diff line number Diff line change
Expand Up @@ -1313,15 +1313,18 @@ public static function build_upgrade_slonik_replica_set($old_db_doc, $new_db_doc
}

// execute post-slony shaping SQL DDL / DCL commands at the end of stage 1 and 3 .slonik files
$sql_stage1_file = $slonik_file_prefix . '_stage1_schema1.sql';
// TODO: need to collect sql_stage1_file names from diff_doc() if there is
// more than one as a result of many changes between definition files
$slony_stage1_ofs->write("ECHO 'DBSteward upgrade replica set " . $new_replica_set['id'] . " stage 1 SQL EXECUTE SCRIPT';\n");
$slony_stage1_ofs->write("EXECUTE SCRIPT (
FILENAME = '" . $slony_stage1_file . "',
FILENAME = '" . $sql_stage1_file . "',
EVENT NODE = " . $new_replica_set['originNodeId'] . "
);\n\n");

$sql_stage3_file = $slonik_file_prefix . '_stage3_schema1.sql';
$slony_stage3_ofs->write("ECHO 'DBSteward upgrade replica set " . $new_replica_set['id'] . " stage 3 SQL EXECUTE SCRIPT';\n");
$slony_stage3_ofs->write("EXECUTE SCRIPT (
FILENAME = '" . $slony_stage3_file . "',
FILENAME = '" . $sql_stage3_file . "',
EVENT NODE = " . $new_replica_set['originNodeId'] . "
);\n\n");
}
Expand Down

0 comments on commit dde6d5b

Please sign in to comment.