cmu-db/dbdb.io

The On-line Database of Databases

578

stars

472

commits

Python

primary language

Sep 9, 2026

updated

dbdb.io
database

README

Tests

Database of Databases

Installation

sudo apt-get install build-essential libffi-dev libpq-dev python3-dev postgresql-common-dev libcairo2
uv sync

Running the development server

uv run python manage.py runserver

Deployment

Run deploy/update_dbdb_app.sh on the production machine to fetch new changes, run migrations, and restart the wsgi server.


Test fixtures

Test fixtures live in data/fixtures/. Django loads them by name; the search path is configured in settings.py via FIXTURE_DIRS.

FixtureContentsSource
adminuser.jsonSuperuser account for testsStatic
testuser.jsonNon-superuser account for testsStatic
core_features.jsonFeature + FeatureOption rowsDumped from production (see below)
core_attributes.jsonAttribute + AttributeOption rowsDumped from production (see below)
core_system.jsonTwo synthetic test systems (SQLite, XXX)Static
core_savedsearch.jsonOne saved search for testingStatic

Regenerating fixtures from production

Requires Tailscale to be connected so db-web.tail5fc291.ts.net is reachable.

# Features and feature options
uv run python manage.py dumpdata core.feature core.featureoption \
    --indent 2 -o data/fixtures/core_features.json

# Attributes and attribute options
uv run python manage.py dumpdata core.attribute core.attributeoption \
    --indent 2 -o data/fixtures/core_attributes.json

These commands use the DATABASE_URL in .env, which points to the production database.

Loading fixtures into a local database

uv run python manage.py loaddata adminuser testuser \
    core_features core_attributes core_system core_savedsearch

Running the tests

Tests require a local PostgreSQL instance. The test runner creates and destroys a dedicated database (test_dbdb_io) on every run.

PGUSER=<your-local-pg-user> uv run python manage.py test dbdb.core \
    --settings=dbdb.test_settings --verbosity=2

The dbdb.test_settings module overrides the production DATABASE_URL with local PostgreSQL connection parameters. It reads the following environment variables (all optional, with defaults shown):

VariableDefaultNotes
PGUSERdbdb_userMust have CREATEDB privilege
PGPASSWORD(empty)Omit if using peer auth (Unix socket)
PGHOST(empty)Empty = Unix socket (peer auth); localhost = TCP
PGPORT5432
PGDATABASEpostgresConnection database — must differ from test_dbdb_io

The test database is always named test_dbdb_io and is dropped and recreated fresh on every run.

Contributors

apavlo

300 commits

jcemelanda

71 commits

pembo13

67 commits

dependabot[bot]

32 commits

cmu-db/dbdb.io

The On-line Database of Databases

578

stars

472

commits

Python

primary language

Sep 9, 2026

updated

dbdb.io
database

README

Tests

Database of Databases

Installation

sudo apt-get install build-essential libffi-dev libpq-dev python3-dev postgresql-common-dev libcairo2
uv sync

Running the development server

uv run python manage.py runserver

Deployment

Run deploy/update_dbdb_app.sh on the production machine to fetch new changes, run migrations, and restart the wsgi server.


Test fixtures

Test fixtures live in data/fixtures/. Django loads them by name; the search path is configured in settings.py via FIXTURE_DIRS.

FixtureContentsSource
adminuser.jsonSuperuser account for testsStatic
testuser.jsonNon-superuser account for testsStatic
core_features.jsonFeature + FeatureOption rowsDumped from production (see below)
core_attributes.jsonAttribute + AttributeOption rowsDumped from production (see below)
core_system.jsonTwo synthetic test systems (SQLite, XXX)Static
core_savedsearch.jsonOne saved search for testingStatic

Regenerating fixtures from production

Requires Tailscale to be connected so db-web.tail5fc291.ts.net is reachable.

# Features and feature options
uv run python manage.py dumpdata core.feature core.featureoption \
    --indent 2 -o data/fixtures/core_features.json

# Attributes and attribute options
uv run python manage.py dumpdata core.attribute core.attributeoption \
    --indent 2 -o data/fixtures/core_attributes.json

These commands use the DATABASE_URL in .env, which points to the production database.

Loading fixtures into a local database

uv run python manage.py loaddata adminuser testuser \
    core_features core_attributes core_system core_savedsearch

Running the tests

Tests require a local PostgreSQL instance. The test runner creates and destroys a dedicated database (test_dbdb_io) on every run.

PGUSER=<your-local-pg-user> uv run python manage.py test dbdb.core \
    --settings=dbdb.test_settings --verbosity=2

The dbdb.test_settings module overrides the production DATABASE_URL with local PostgreSQL connection parameters. It reads the following environment variables (all optional, with defaults shown):

VariableDefaultNotes
PGUSERdbdb_userMust have CREATEDB privilege
PGPASSWORD(empty)Omit if using peer auth (Unix socket)
PGHOST(empty)Empty = Unix socket (peer auth); localhost = TCP
PGPORT5432
PGDATABASEpostgresConnection database — must differ from test_dbdb_io

The test database is always named test_dbdb_io and is dropped and recreated fresh on every run.

Contributors

apavlo

300 commits

jcemelanda

71 commits

pembo13

67 commits

dependabot[bot]

32 commits

Languages

Python

74.1%

HTML

12.8%

JavaScript

8.0%

CSS

4.9%