, Error, FatalError>;
@@ -193,6 +203,7 @@ pub struct DiskDb {
conn: Connection,
}
+/*
fn setup_test_database(conn: &Connection) -> Result<(), FatalError> {
let mut gamecount_stmt = conn.prepare("SELECT count(*) FROM games").unwrap();
let mut count = gamecount_stmt.query([]).unwrap();
@@ -236,6 +247,7 @@ fn setup_test_database(conn: &Connection) -> Result<(), FatalError> {
Ok(())
}
+*/
impl DiskDb {
pub fn new(path: Option
) -> Result
@@ -251,30 +263,36 @@ impl DiskDb {
.to_latest(&mut conn)
.map_err(|err| FatalError::DatabaseMigrationFailure(format!("{}", err)))?;
- setup_test_database(&conn)?;
+ // setup_test_database(&conn)?;
Ok(DiskDb { conn })
}
fn users(&self) -> Result, FatalError> {
- let mut stmt = self.conn.prepare("SELECT * FROM USERS")
+ let mut stmt = self
+ .conn
+ .prepare("SELECT * FROM users")
.map_err(|err| FatalError::ConstructQueryFailure(format!("{}", err)))?;
- let items = stmt.query_map([], |row| {
- Ok(UserRow {
- id: row.get(0).unwrap(),
- name: row.get(1).unwrap(),
- password: row.get(2).unwrap(),
- admin: row.get(3).unwrap(),
- enabled: row.get(4).unwrap(),
+ let items = stmt
+ .query_map([], |row| {
+ Ok(UserRow {
+ id: row.get(0).unwrap(),
+ name: row.get(1).unwrap(),
+ password: row.get(2).unwrap(),
+ admin: row.get(3).unwrap(),
+ enabled: row.get(4).unwrap(),
+ })
})
- }).unwrap().collect::, rusqlite::Error>>().unwrap();
+ .unwrap()
+ .collect::, rusqlite::Error>>()
+ .unwrap();
Ok(items)
}
fn user(&self, id: UserId) -> Result