diff --git a/.gitignore b/.gitignore index ad6514c..4571106 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /target /Cargo.lock -/examples/hello-toasty-rustqlite/*.sql +/examples/hello-toasty-rustqlite/*.db3 diff --git a/examples/hello-toasty-rustqlite/sqlite_db.sql b/examples/hello-toasty-rustqlite/sqlite_db.sql new file mode 100644 index 0000000..4969348 Binary files /dev/null and b/examples/hello-toasty-rustqlite/sqlite_db.sql differ diff --git a/examples/hello-toasty-rustqlite/src/main.rs b/examples/hello-toasty-rustqlite/src/main.rs index 8994295..127b897 100644 --- a/examples/hello-toasty-rustqlite/src/main.rs +++ b/examples/hello-toasty-rustqlite/src/main.rs @@ -17,7 +17,7 @@ async fn main() { // println!("{schema:#?}"); // Use rustqlite as the driver, creating a file locally in `./` - let filename = "sqlite_db.sql"; + let filename = "toasty.db3"; let file_path = format!("./{}", filename); let file = PathBuf::from(file_path.as_str()); let driver = Sqlite::open(file).unwrap(); @@ -81,8 +81,8 @@ async fn main() { ); // Load the user again - let user = User::find_by_id(&u2.id).get(&db).await.unwrap(); - println!(" reloaded -> {user:#?}"); + let user = User::find_by_id(&u1.id).get(&db).await.unwrap(); + println!(" reloaded, notice change to the user's name -> {user:#?}"); println!(" ~~~~~~~~~~~ CREATE TODOs ~~~~~~~~~~~~"); @@ -110,6 +110,7 @@ async fn main() { // let mut todos = db::Todo::find_by_user(&u2.id).all(&db).await.unwrap(); // Delete user + let user = User::find_by_id(&u2.id).get(&db).await.unwrap(); user.delete(&db).await.unwrap(); assert!(User::find_by_id(&u2.id).get(&db).await.is_err());