Database

You can set environment variables either through the command line, the Nix flake (if you are running nix/NixOS), or the .env file.

Uses the following data storing services:

  • PostgreSQL 16
  • Valkey 8.0.2 (or Redis, haven't tested)

Create migration database

Run:

sqlx database create

Only run this if the DATABASE_URL environment variable is set (with the postgres:// protocol) and if the database migration has not been set up yet.

Create a new migration file

Run:

sqlx migrate add -r <name>

where <name> is the name of the database file name given.

This new migration will be placed in the migrations/ directory.

Run the migrations

Run:

sqlx migrate run

to run the all migrations.

To revert migraitons:

sqlx migrate revert

to rollback (all?) migrations.