From 0102c063bf56c5517b6c7556ccb70694d53ab6f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Tue, 28 Apr 2020 20:28:35 +0100 Subject: [PATCH] uniformize version as i32 (#89) --- refinery_core/src/drivers/mysql.rs | 4 ++-- refinery_core/src/drivers/mysql_async.rs | 4 ++-- refinery_core/src/drivers/postgres.rs | 4 ++-- refinery_core/src/drivers/rusqlite.rs | 4 ++-- refinery_core/src/drivers/tokio_postgres.rs | 4 ++-- refinery_core/src/runner.rs | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/refinery_core/src/drivers/mysql.rs b/refinery_core/src/drivers/mysql.rs index 2aa020d1..5cf6eb5f 100644 --- a/refinery_core/src/drivers/mysql.rs +++ b/refinery_core/src/drivers/mysql.rs @@ -13,13 +13,13 @@ fn query_applied_migrations( let mut applied = Vec::new(); for row in rows { let row = row?; - let version: i64 = row.get(0).unwrap(); + let version = row.get(0).unwrap(); let applied_on: String = row.get(2).unwrap(); let applied_on = DateTime::parse_from_rfc3339(&applied_on) .unwrap() .with_timezone(&Local); applied.push(AppliedMigration { - version: version as usize, + version, name: row.get(1).unwrap(), applied_on, checksum: row.get(3).unwrap(), diff --git a/refinery_core/src/drivers/mysql_async.rs b/refinery_core/src/drivers/mysql_async.rs index 64af0ba0..b7b79bae 100644 --- a/refinery_core/src/drivers/mysql_async.rs +++ b/refinery_core/src/drivers/mysql_async.rs @@ -15,14 +15,14 @@ async fn query_applied_migrations( let (transaction, applied) = result .map_and_drop(|row| { - let (version, name, applied_on, checksum): (i64, String, String, String) = + let (version, name, applied_on, checksum): (i32, String, String, String) = mysql_async::from_row(row); let applied_on = DateTime::parse_from_rfc3339(&applied_on) .unwrap() .with_timezone(&Local); AppliedMigration { - version: version as usize, + version, name, applied_on, checksum, diff --git a/refinery_core/src/drivers/postgres.rs b/refinery_core/src/drivers/postgres.rs index 4fc348ef..6beabea5 100644 --- a/refinery_core/src/drivers/postgres.rs +++ b/refinery_core/src/drivers/postgres.rs @@ -10,14 +10,14 @@ fn query_applied_migrations( let rows = transaction.query(query, &[])?; let mut applied = Vec::new(); for row in rows.into_iter() { - let version: i32 = row.get(0); + let version = row.get(0); let applied_on: String = row.get(2); let applied_on = DateTime::parse_from_rfc3339(&applied_on) .unwrap() .with_timezone(&Local); applied.push(AppliedMigration { - version: version as usize, + version, name: row.get(1), applied_on, checksum: row.get(3), diff --git a/refinery_core/src/drivers/rusqlite.rs b/refinery_core/src/drivers/rusqlite.rs index ed3d2c38..5b7a477e 100644 --- a/refinery_core/src/drivers/rusqlite.rs +++ b/refinery_core/src/drivers/rusqlite.rs @@ -11,14 +11,14 @@ fn query_applied_migrations( let mut rows = stmt.query(NO_PARAMS)?; let mut applied = Vec::new(); while let Some(row) = rows.next()? { - let version: isize = row.get(0)?; + let version = row.get(0)?; let applied_on: String = row.get(2)?; let applied_on = DateTime::parse_from_rfc3339(&applied_on) .unwrap() .with_timezone(&Local); //version, name, installed_on, checksum applied.push(AppliedMigration { - version: version as usize, + version, name: row.get(1)?, applied_on, checksum: row.get(3)?, diff --git a/refinery_core/src/drivers/tokio_postgres.rs b/refinery_core/src/drivers/tokio_postgres.rs index 27cd9605..a811c63c 100644 --- a/refinery_core/src/drivers/tokio_postgres.rs +++ b/refinery_core/src/drivers/tokio_postgres.rs @@ -12,14 +12,14 @@ async fn query_applied_migrations( let rows = transaction.query(query, &[]).await?; let mut applied = Vec::new(); for row in rows.into_iter() { - let version: i32 = row.get(0); + let version = row.get(0); let applied_on: String = row.get(2); let applied_on = DateTime::parse_from_rfc3339(&applied_on) .unwrap() .with_timezone(&Local); applied.push(AppliedMigration { - version: version as usize, + version, name: row.get(1), applied_on, checksum: row.get(3), diff --git a/refinery_core/src/runner.rs b/refinery_core/src/runner.rs index 82d7986c..d7e2c359 100644 --- a/refinery_core/src/runner.rs +++ b/refinery_core/src/runner.rs @@ -32,7 +32,7 @@ pub enum MigrationPrefix { #[derive(Clone, Debug)] pub struct Migration { pub name: String, - pub version: usize, + pub version: i32, pub prefix: MigrationPrefix, pub sql: String, } @@ -116,7 +116,7 @@ impl PartialOrd for Migration { #[derive(Clone, Debug)] pub struct AppliedMigration { pub name: String, - pub version: usize, + pub version: i32, pub applied_on: DateTime, pub checksum: String, }