db_management.py

DB initialisation and migration check.

db_management.add_default_user(db)[source]

Add a default user.

User that will be added:

{
    'name': 'Default User',
    'email': 'default_user@example.com',
    'permissions': ['USER_MANAGEMENT']
}

Api_key: 1234 Auth_id: default::default

db_management.check_db(config: dict)[source]

Perform database checks.

  • check if first-time setup has been performed

  • check that the data structure is up to date (migrations)

Parameters

config (dict) – Configuration for the data tracker

db_management.check_migrations(db)[source]

Check if any migrations need to be performed on the db.

Parameters

config (dict) – Configuration for the data tracker

db_management.init_db(db)[source]

Do first time-setup for the database.

  • create a default user

  • set current db_version