style: rename table name in function name
This commit is contained in:
parent
80c9b6988b
commit
f588912175
1 changed files with 3 additions and 3 deletions
|
@ -8,7 +8,7 @@ pub fn apply_sql(client: &mut Client, sql_content: &str) -> Result<(), Error> {
|
||||||
client.batch_execute(sql_content)
|
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()
|
e.to_string()
|
||||||
.contains(r#"relation "migrations" does not exist"#)
|
.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
|
let res = client
|
||||||
.query("SELECT name FROM migrations ORDER BY id DESC", &[])
|
.query("SELECT name FROM migrations ORDER BY id DESC", &[])
|
||||||
.or_else(|e| {
|
.or_else(|e| {
|
||||||
if is_migration_table_not_found(&e) {
|
if is_migrations_table_not_found(&e) {
|
||||||
Ok(Vec::new())
|
Ok(Vec::new())
|
||||||
} else {
|
} else {
|
||||||
Err(e)
|
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())
|
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(
|
apply_sql(
|
||||||
client,
|
client,
|
||||||
r#"CREATE TABLE IF NOT EXISTS migrations (
|
r#"CREATE TABLE IF NOT EXISTS migrations (
|
||||||
|
|
Reference in a new issue