- Install docker
- Run the following command to get a postgresql database running -
docker run --name <container-name> -p 5432:5432 -e POSTGRES_PASSWORD=<password> -d postgres:14
. Note that default user and database is postgres. - Download migrations from sqlxmq to setup database for message queue.
- Install psql to apply migrations to db.
- Use
cargo install rargs
and run the following to apply migrations -ls migrations/**/*up.sql | rargs psql postgres://postgres:<password>@localhost/postgres -f {0}
- Add a
.env
file with a single key for the connection stringDATABASE_URL=postgres://postgres:<password>@localhost/postgres
. This will be read by the application at runtime from the environment and be used to connect to the environment. This will also be used by sqlx to verify sql queries at compile time. NOTE: You only need to run this migration once for a fresh database.
This repository has been archived by the owner on Dec 14, 2024. It is now read-only.