From 3d0f7f2f80d55f23206afb43c96aa8018ce9b277 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Tue, 27 Dec 2016 02:38:21 -0600 Subject: [PATCH] Clarify todo example requirements. --- examples/todo/Cargo.toml | 2 +- examples/todo/README.md | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/examples/todo/Cargo.toml b/examples/todo/Cargo.toml index 1226199b..df1e403a 100644 --- a/examples/todo/Cargo.toml +++ b/examples/todo/Cargo.toml @@ -11,7 +11,7 @@ lazy_static = "*" serde = "0.8" serde_json = "0.8" serde_derive = "0.8" -diesel = "0.9" +diesel = { version = "0.9", features = ["sqlite"] } diesel_codegen = { version = "0.9", features = ["sqlite"] } [dependencies.rocket_contrib] diff --git a/examples/todo/README.md b/examples/todo/README.md index f284443b..c7f81025 100644 --- a/examples/todo/README.md +++ b/examples/todo/README.md @@ -1,16 +1,23 @@ -Rocket Todo Example -=================== +# Rocket Todo Example -Before running this example, you'll need to ensure there's a database file -present. You can do this with Diesel. +This example makes use of a SQLite database via `diesel` to store todo tasks. As +a result, you'll need to have `sqlite3` and its headers installed: -Running migration with Diesel ------------------------------ + * **OS X:** `brew install sqlite` + * **Debian/Ubuntu:** `apt-get install libsqlite3-dev` + * **Arch:** `pacman -S sqlite` -Just run the following commands in your shell: +**Before running this example, you'll also need to ensure there's a database +file with the correct tables present.** On a Unix machine or with bash +installed, you can simply run the `boostrap.sh` script. The script installs the +`diesel_cli` tools if they're not already installed and runs the migrations. + +## Manually Running Migrations + +You can also run the migrations manually with the following commands: ``` -cargo install diesel_cli # installs the diesel CLI tools -DATABASE_URL=db/db.sql diesel migration run # create db/db.sql +cargo install diesel_cli # install diesel CLI tools +DATABASE_URL=db/db.sql diesel migration run # create db/db.sql ```