diff options
author | Melody Horn <melody@boringcactus.com> | 2021-06-28 17:12:33 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-06-28 17:12:33 -0600 |
commit | 42d14c943eb31753489b39ef58803c543c023bee (patch) | |
tree | e5c7d9e3784192ebdc390dfa481631eaad07f0fd /src/db/migration/mod.rs | |
parent | b1ec80c918dd9e156c049a500983fb15147c6e14 (diff) | |
download | tosin-42d14c943eb31753489b39ef58803c543c023bee.tar.gz tosin-42d14c943eb31753489b39ef58803c543c023bee.zip |
fmt
Diffstat (limited to 'src/db/migration/mod.rs')
-rw-r--r-- | src/db/migration/mod.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/db/migration/mod.rs b/src/db/migration/mod.rs index d511f88..839608f 100644 --- a/src/db/migration/mod.rs +++ b/src/db/migration/mod.rs @@ -1,6 +1,6 @@ pub use tosin_macros::gather_migrations as gather; -use diesel::{Connection, result::Error as DieselError}; +use diesel::{result::Error as DieselError, Connection}; use crate::db::backend::Connectable; @@ -18,12 +18,14 @@ pub struct Migration { impl Migration { pub fn apply<C: Connectable>(&self, app_name: &str, connection: &C::Connection) { // TODO prevent double-applying - connection.transaction::<_, DieselError, _>(|| { - for change in self.changes { - change.apply::<C>(app_name, connection); - } + connection + .transaction::<_, DieselError, _>(|| { + for change in self.changes { + change.apply::<C>(app_name, connection); + } - Ok(()) - }).unwrap(); + Ok(()) + }) + .unwrap(); } } |