sudo apt install libpq-dev libmariadbclient postgresql-libs sqlite
cargo install diesel_cli --no-default-features --features postgres --verbose
diesel setup
-
The next step now is to add our migrations using the CLI:
diesel migration generate add_users
-
We will first edit up.sql to add SQL to create our table.
-
Create the model
-
use diesel to automatically generate the schema it needs in a file called schema.rs.
diesel print-schema > src/schema.rs
-
Apply our database migration
diesel migration run