Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't run scripts that have already been run and have not been modified. #42

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions product/roundhouse/migrators/DefaultDatabaseMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,24 +300,26 @@ 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 (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);
}

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;
}

if (this_script_has_run_already(script_name)
&& !this_script_has_changed_since_last_run(script_name, sql_to_run))
{
return false;
}
return true;
}

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);
Expand Down