Development

Run tests

The tests drop and re-create the database; you should specify a testing database with an environment variable. See Configuration.

Run the tests with, for example:

KINGFISHER_PROCESS_DB_URI=’postgres:///ocdskingfisher-test’ pytest

Create migrations

  1. Create a database migration with Alembic, for example:

    alembic --config=mainalembic.ini revision -m "A short description of what the migration does"
    
  2. Fill in the migration

  3. Add/update tables, indexes and/or constraints in database.py to match the migration

  4. If a new table is created, update the delete_tables method

Note: Do not create simultaneous branches, each with its own migration(s). Instead, merge one branch, then create the next migration, to avoid multiple heads.