This example demonstrates storing external files to use for querying data. Encapsulating your SQL queries can be helpful in several ways, assisting with intellisense, etc.
-
Declare the database URL
export DATABASE_URL="postgres://postgres:password@localhost/files" -
Create the database.
$ sqlx db create -
Run sql migrations
$ sqlx migrate run
Run the project
cargo run files