Skip to content

Commit

Permalink
Add migrations.toml locked mode
Browse files Browse the repository at this point in the history
  • Loading branch information
trevyn committed Jul 20, 2024
1 parent 7692d0c commit 65366e5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions turbosql-impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,9 @@ fn create(table: &Table, minitable: &MiniTable) {
// this keeps file mod date clean so cargo doesn't pathologically rebuild

if old_toml_str != new_toml_str {
if std::env::var("CI").is_ok() || std::env::var("TURBOSQL_LOCKED_MODE").is_ok() {
abort_call_site!("Change in `{}` detected with CI or TURBOSQL_LOCKED_MODE environment variable set. Make sure your `migrations.toml` file is up-to-date.", migrations_toml_path_lossy);
};
fs::write(&migrations_toml_path, new_toml_str)
.unwrap_or_else(|e| abort_call_site!("Unable to write {}: {:?}", migrations_toml_path_lossy, e));
}
Expand Down

0 comments on commit 65366e5

Please sign in to comment.