Formatting
This commit is contained in:
1 parent
dddac01bdf
commit
10cf7f0d2e
29 files changed
+138
-138
No files matched your search
@@ -1,12 +1,14 @@
|
||||
use rusqlite::Connection;
|
||||
use crate::fs::*;
|
||||
use rusqlite::Connection;
|
||||
|
||||
pub fn create_db() {
|
||||
let db_file = db_path();
|
||||
if !db_file.exists() {
|
||||
std::fs::File::create(&db_file).expect("Database file creation failed");
|
||||
let connection = Connection::open(&db_file).expect("Connection open failed");
|
||||
connection.execute("PRAGMA foreign_keys = ON;", []).expect("Failed to set PRAGMA");
|
||||
connection
|
||||
.execute("PRAGMA foreign_keys = ON;", [])
|
||||
.expect("Failed to set PRAGMA");
|
||||
|
||||
create_tables(&connection);
|
||||
}
|
||||
@@ -52,6 +54,8 @@ fn make_card_stats(conn: &Connection) -> Result<(), rusqlite::Error> {
|
||||
pub fn default_connection() -> Connection {
|
||||
let db_file = db_path();
|
||||
let connection = Connection::open(db_file).expect("Failed to open database");
|
||||
connection.execute("PRAGMA foreign_keys = ON;", []).expect("Failed to set PRAGMA");
|
||||
connection
|
||||
.execute("PRAGMA foreign_keys = ON;", [])
|
||||
.expect("Failed to set PRAGMA");
|
||||
connection
|
||||
}
|
||||
Reference in new issue
Block a user