Format some SQL queries better
This commit is contained in:
parent
aed95202ce
commit
e5a2e169a2
@ -34,7 +34,10 @@ fn setup_db() -> Result<DbConnection> {
|
||||
}
|
||||
|
||||
fn query_sections(conn: &DbConnection) -> Result<Sections> {
|
||||
let mut statement = conn.prepare_cached("SELECT id, name, interface_id FROM sections;")?;
|
||||
let mut statement = conn.prepare_cached(
|
||||
"SELECT s.id, s.name, s.interface_id \
|
||||
FROM sections AS s;",
|
||||
)?;
|
||||
let rows = statement.query_map(NO_PARAMS, Section::from_sql)?;
|
||||
let mut sections = Sections::new();
|
||||
for row in rows {
|
||||
|
@ -85,7 +85,9 @@ pub fn get_db_version(conn: &Connection) -> MigrationResult<MigrationVersion> {
|
||||
}
|
||||
|
||||
let version: u32 = conn.query_row(
|
||||
"SELECT version FROM db_version WHERE id = 1",
|
||||
"SELECT v.version \
|
||||
FROM db_version AS v \
|
||||
WHERE id = 1",
|
||||
NO_PARAMS,
|
||||
|row| row.get(0),
|
||||
)?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user