server: Fix extra error message when DB doesn't exist

Fixes #270
This commit is contained in:
Valentin Tolmer 2022-08-01 08:35:44 +02:00 committed by nitnelave
parent 9f70910283
commit 897704fab3

View File

@ -77,11 +77,10 @@ async fn column_exists(pool: &Pool, table_name: &str, column_name: &str) -> sqlx
"SELECT COUNT(*) AS col_count FROM pragma_table_info('{}') WHERE name = '{}'",
table_name, column_name
);
Ok(sqlx::query(&query)
.fetch_one(pool)
.await?
.get::<i32, _>("col_count")
> 0)
match sqlx::query(&query).fetch_one(pool).await {
Err(_) => Ok(false),
Ok(row) => Ok(row.get::<i32, _>("col_count") > 0),
}
}
pub async fn create_group(group_name: &str, pool: &Pool) -> sqlx::Result<()> {