diff options
author | Melody Horn <melody@boringcactus.com> | 2021-06-29 22:44:11 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-06-29 22:44:11 -0600 |
commit | 9829bbfcd57c57e237c6aacb96a78d0b9f5bab68 (patch) | |
tree | 43dc643d7b592d9abc4c5f89121e249ccb597d7d /src/db/migration | |
parent | 9dd7f2256a82f95096d928aaef70d15603152ebc (diff) | |
download | tosin-9829bbfcd57c57e237c6aacb96a78d0b9f5bab68.tar.gz tosin-9829bbfcd57c57e237c6aacb96a78d0b9f5bab68.zip |
lol no generics
Diffstat (limited to 'src/db/migration')
-rw-r--r-- | src/db/migration/change.rs | 8 | ||||
-rw-r--r-- | src/db/migration/mod.rs | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/db/migration/change.rs b/src/db/migration/change.rs index 8bb8bf6..a07ef24 100644 --- a/src/db/migration/change.rs +++ b/src/db/migration/change.rs @@ -1,6 +1,6 @@ -use diesel::Connection; +use diesel::Connection as _; -use crate::db::backend::Connectable; +use crate::db::backend::{Connection, SqlGenerator}; use crate::db::models::Field; pub enum DatabaseChange { @@ -12,7 +12,7 @@ pub enum DatabaseChange { } impl DatabaseChange { - pub fn apply<C: Connectable>(&self, app_name: &str, connection: &C::Connection) { + pub fn apply(&self, app_name: &str, connection: &Connection) { use barrel::{types, Migration, Table}; match self { @@ -55,7 +55,7 @@ impl DatabaseChange { m.create_table(table_name, callback); } - connection.execute(&m.make::<C::SqlGenerator>()).unwrap(); + connection.execute(&m.make::<SqlGenerator>()).unwrap(); } } } diff --git a/src/db/migration/mod.rs b/src/db/migration/mod.rs index 839608f..e6b3266 100644 --- a/src/db/migration/mod.rs +++ b/src/db/migration/mod.rs @@ -1,8 +1,8 @@ pub use tosin_macros::gather_migrations as gather; -use diesel::{result::Error as DieselError, Connection}; +use diesel::{result::Error as DieselError, Connection as _}; -use crate::db::backend::Connectable; +use crate::db::backend::Connection; mod change; @@ -16,12 +16,12 @@ pub struct Migration { } impl Migration { - pub fn apply<C: Connectable>(&self, app_name: &str, connection: &C::Connection) { + pub fn apply(&self, app_name: &str, connection: &Connection) { // TODO prevent double-applying connection .transaction::<_, DieselError, _>(|| { for change in self.changes { - change.apply::<C>(app_name, connection); + change.apply(app_name, connection); } Ok(()) |