aboutsummaryrefslogtreecommitdiff
path: root/src/db/migration
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/migration')
-rw-r--r--src/db/migration/change.rs8
-rw-r--r--src/db/migration/mod.rs8
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(())