diff --git a/migra-cli/src/database.rs b/migra-cli/src/database.rs index ae64ccd..c6c5c25 100644 --- a/migra-cli/src/database.rs +++ b/migra-cli/src/database.rs @@ -8,7 +8,7 @@ pub fn apply_sql(client: &mut Client, sql_content: &str) -> Result<(), Error> { client.batch_execute(sql_content) } -pub fn is_migration_table_not_found(e: &Error) -> bool { +pub fn is_migrations_table_not_found(e: &Error) -> bool { e.to_string() .contains(r#"relation "migrations" does not exist"#) } @@ -17,7 +17,7 @@ pub fn applied_migrations(client: &mut Client) -> Result, Error> { let res = client .query("SELECT name FROM migrations ORDER BY id DESC", &[]) .or_else(|e| { - if is_migration_table_not_found(&e) { + if is_migrations_table_not_found(&e) { Ok(Vec::new()) } else { Err(e) @@ -27,7 +27,7 @@ pub fn applied_migrations(client: &mut Client) -> Result, Error> { Ok(res.into_iter().map(|row| row.get(0)).collect()) } -pub fn create_migration_table(client: &mut Client) -> Result<(), Error> { +pub fn create_migrations_table(client: &mut Client) -> Result<(), Error> { apply_sql( client, r#"CREATE TABLE IF NOT EXISTS migrations (