diff --git a/product/roundhouse/migrators/DefaultDatabaseMigrator.cs b/product/roundhouse/migrators/DefaultDatabaseMigrator.cs index 96ab23b0..121314b5 100644 --- a/product/roundhouse/migrators/DefaultDatabaseMigrator.cs +++ b/product/roundhouse/migrators/DefaultDatabaseMigrator.cs @@ -300,26 +300,24 @@ private bool this_script_has_changed_since_last_run(string script_name, string s return !hash_is_same; } - private bool this_script_should_run(string script_name, string sql_to_run, bool run_this_script_once, bool run_this_script_every_time) - { - if (this_is_an_every_time_script(script_name, run_this_script_every_time)) - { - return true; - } - - if (this_script_has_run_already(script_name) && run_this_script_once) - { - return false; - } - - if (is_running_all_any_time_scripts && !run_this_script_once) - { - return true; - } - - return this_script_has_changed_since_last_run(script_name, sql_to_run); - } - + private bool this_script_should_run(string script_name, string sql_to_run, bool run_this_script_once, bool run_this_script_every_time) + { + if (this_is_an_every_time_script(script_name, run_this_script_every_time)) + { + return true; + } + + if (is_running_all_any_time_scripts && !run_this_script_once) + { + return true; + } + + return + !run_this_script_once || + this_script_has_changed_since_last_run(script_name, sql_to_run) || + !this_script_has_run_already(script_name); + } + public bool this_is_an_environment_file_and_its_in_the_right_environment(string script_name, Environment environment) { Log.bound_to(this).log_a_debug_event_containing("Checking to see if {0} is an environment file. We are in the {1} environment.", script_name, environment.name);