style: rename table name in function name

This commit is contained in:
Dmitriy Pleshevskiy 2021-02-08 23:39:22 +03:00
parent 80c9b6988b
commit f588912175
1 changed files with 3 additions and 3 deletions

View File

@ -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<Vec<String>, 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<Vec<String>, 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 (