Skip to content

Commit

Permalink
rerun if migrations.toml changed
Browse files Browse the repository at this point in the history
  • Loading branch information
trevyn committed Jan 26, 2022
1 parent e5d4453 commit 113ed18
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Unused or reverted migrations that are created during development can be manuall
- On launch, versions of your binary built with a newer schema will automatically apply the appropriate migrations to an older database.
- If you're feeling adventurous, you can add your own schema migration entries to the bottom of the list. (For creating indexes, etc.)
- You can hand-write complex migrations as well, see [turbo/migrations.toml](https://github.com/trevyn/turbo-also-historical/blob/main/migrations.toml) for some examples.
- Questions? Ask on Discord [https://discord.gg/RX3rTWUzUD](https://discord.gg/RX3rTWUzUD) or open a GitHub issue.
- Please open a GitHub issue with any questions or suggestions!

## Where's my data?

Expand Down
3 changes: 1 addition & 2 deletions turbosql-impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,7 @@ fn make_migrations(table: &Table) -> Vec<String> {
}

fn migrations_toml_path() -> std::path::PathBuf {
let mut path = std::path::PathBuf::new();
path.push(env!("OUT_DIR"));
let mut path = std::path::PathBuf::from(env!("OUT_DIR"));
while path.file_name() != Some(std::ffi::OsStr::new("target")) {
path.pop();
}
Expand Down
8 changes: 4 additions & 4 deletions turbosql/build.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
fn main() {
let mut path = std::path::PathBuf::new();
path.push(std::env::var_os("OUT_DIR").unwrap());
let mut path = std::path::PathBuf::from(std::env::var_os("OUT_DIR").unwrap());
while path.file_name() != Some(std::ffi::OsStr::new("target")) {
path.pop();
}
path.pop();
path.push("migrations.toml");

let mut path2 = std::path::PathBuf::new();
path2.push(std::env::var_os("OUT_DIR").unwrap());
println!("cargo:rerun-if-changed={}", path.to_str().unwrap());

let mut path2 = std::path::PathBuf::from(std::env::var_os("OUT_DIR").unwrap());
path2.push("migrations.toml");

// docs.rs is a largely read-only filesystem
Expand Down

0 comments on commit 113ed18

Please sign in to comment.