Clarify todo example requirements.

This commit is contained in:
Sergio Benitez 2016-12-27 02:38:21 -06:00
parent 588d95aa58
commit 3d0f7f2f80
2 changed files with 17 additions and 10 deletions

View File

@ -11,7 +11,7 @@ lazy_static = "*"
serde = "0.8" serde = "0.8"
serde_json = "0.8" serde_json = "0.8"
serde_derive = "0.8" serde_derive = "0.8"
diesel = "0.9" diesel = { version = "0.9", features = ["sqlite"] }
diesel_codegen = { version = "0.9", features = ["sqlite"] } diesel_codegen = { version = "0.9", features = ["sqlite"] }
[dependencies.rocket_contrib] [dependencies.rocket_contrib]

View File

@ -1,16 +1,23 @@
Rocket Todo Example # Rocket Todo Example
===================
Before running this example, you'll need to ensure there's a database file This example makes use of a SQLite database via `diesel` to store todo tasks. As
present. You can do this with Diesel. 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 cargo install diesel_cli # install diesel CLI tools
DATABASE_URL=db/db.sql diesel migration run # create db/db.sql DATABASE_URL=db/db.sql diesel migration run # create db/db.sql
``` ```