Skip to content

Commit

Permalink
uniformize version as i32 (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
jxs authored Apr 28, 2020
1 parent 1d0cddc commit 0102c06
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions refinery_core/src/drivers/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions refinery_core/src/drivers/mysql_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions refinery_core/src/drivers/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions refinery_core/src/drivers/rusqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?,
Expand Down
4 changes: 2 additions & 2 deletions refinery_core/src/drivers/tokio_postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions refinery_core/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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<Local>,
pub checksum: String,
}
Expand Down

0 comments on commit 0102c06

Please sign in to comment.