Skip to main content

The database

--db (or HUNT_DB, or make serve DB=…) says which:

hunt serve --db ~/.hunt/hunt.db # SQLite, a file (the default)
hunt serve --db postgres://hunt:secret@localhost/hunt # PostgreSQL (12 or later)
hunt serve --db mysql://hunt:secret@localhost:3306/hunt # MySQL (8.0.16 or later)
  • The database must be empty, or hunt's. An empty one gets hunt's tables on first start; for PostgreSQL and MySQL, make the database first (CREATE DATABASE hunt).
  • Upgrades: SQLite databases are upgraded in place when a newer hunt opens them. PostgreSQL and MySQL ones start at the current schema; to carry one across a schema change, back it up with the hunt that made it and import the backup into a new database.
  • Connections: PostgreSQL and MySQL are reached without TLS, so use them on the same machine or a private network.
  • Tests: make db-up starts both servers in Docker; make test-all runs the API tests on SQLite, PostgreSQL and MySQL.