-
Create .env file if needed. Run
docker-compose up -d
to run Postgres in the background. -
Declare the database URL
export DATABASE_URL="postgres://postgres:password@localhost/todos"
Access from command line like:
psql postgresql://postgres:password@localhost/todos -c 'select * from t
odos' ```
-
Create the database.
$ sqlx db create
-
Run sql migrations
$ sqlx migrate run
Add a todo
cargo run -- add "todo description"
Complete a todo.
cargo run -- done <todo id>
List all todos
cargo run