src/dirbs/utils.py
def verify_db_schema_version(conn):
    """
    Function used to check whether the DB schema version matches the code schema version.

    Arguments:
        conn: dirbs db connection object
    Raises:
        DatabaseSchemaException: if db schema is not installed or code and db schema version is not matched
    """
    logger = logging.getLogger('dirbs.db')
    version = query_db_schema_version(conn)
    if version != code_db_schema_version:
        if version is None:
            logger.error('DB schema has not been installed via dirbs-db install!')
            raise DatabaseSchemaException('No DB schema installed - perform a dirbs-db install first!')
        else:
            logger.error('DB schema version does not match code!')
            logger.error('Code schema version: %d', code_db_schema_version)
            logger.error('DB schema version: %d', version)
            raise DatabaseSchemaException('Mismatch between code and DB schema versions - perform a dirbs-db upgrade!')

    Function used to check whether the DB schema version matches the code schema version.

    Arguments:
        conn: dirbs db connection object
    Raises:
        DatabaseSchemaException: if db schema is not installed or code and db schema version is not matched
    
Function used to check whether the DB schema version matches the code schema version.
Function used to check whether the DB schema version matches the code schema version .
def verify_db_schema_version(conn):
    logger = logging.getLogger('dirbs.db')
    version = query_db_schema_version(conn)
    if version != code_db_schema_version:
        if version is None:
            logger.error('DB schema has not been installed via dirbs-db install!')
            raise DatabaseSchemaException('No DB schema installed - perform a dirbs-db install first!')
        else:
            logger.error('DB schema version does not match code!')
            logger.error('Code schema version: %d', code_db_schema_version)
            logger.error('DB schema version: %d', version)
            raise DatabaseSchemaException('Mismatch between code and DB schema versions - perform a dirbs-db upgrade!')
def verify_db_schema_version ( conn ) : logger = logging . getLogger ( 'dirbs.db' ) version = query_db_schema_version ( conn ) if version != code_db_schema_version : if version is None : logger . error ( 'DB schema has not been installed via dirbs-db install!' ) raise DatabaseSchemaException ( 'No DB schema installed - perform a dirbs-db install first!' ) else : logger . error ( 'DB schema version does not match code!' ) logger . error ( 'Code schema version: %d' , code_db_schema_version ) logger . error ( 'DB schema version: %d' , version ) raise DatabaseSchemaException ( 'Mismatch between code and DB schema versions - perform a dirbs-db upgrade!' )
Function used to check whether the DB schema version matches the code schema version.
Function used to check whether the DB schema version matches the code schema version .
"""
    Function used to check whether the DB schema version matches the code schema version.

    Arguments:
        conn: dirbs db connection object
    Raises:
        DatabaseSchemaException: if db schema is not installed or code and db schema version is not matched
    """
if db schema is not installed or code and db schema version is not matched
if db schema is not installed or code and db schema version is not matched
DatabaseSchemaException
conn
dirbs db connection object
dirbs db connection object