'Ensure the proper schema is used by the database.
:param database_version: Current version of the database.
:return:'

def check_database(self, database_version):

    assert isinstance(database_version, unicode)
    assert database_version.isdigit()
    assert (int(database_version) >= 0)
    database_version = int(database_version)
    if (database_version < self.LATEST_DB_VERSION):
        while (database_version < self.LATEST_DB_VERSION):
            upgrade_script = self.get_upgrade_script(current_version=database_version)
            if upgrade_script:
                self.executescript(upgrade_script)
            database_version += 1
        self.executescript(self.get_schema())
        self.commit()
    return self.LATEST_DB_VERSION
