'Preconditions: object_store must be set on self.'

def _configure_models(self, check_migrate_databases=False, check_migrate_tools=False, config_file=None):

    if self.config.database_connection:
        db_url = self.config.database_connection
    else:
        db_url = ('sqlite:///%s?isolation_level=IMMEDIATE' % self.config.database)
    install_db_url = self.config.install_database_connection
    combined_install_database = (not (install_db_url and (install_db_url != db_url)))
    install_db_url = (install_db_url or db_url)
    if check_migrate_databases:
        from galaxy.model.migrate.check import create_or_verify_database
        create_or_verify_database(db_url, config_file, self.config.database_engine_options, app=self)
        if (not combined_install_database):
            from galaxy.model.tool_shed_install.migrate.check import create_or_verify_database as tsi_create_or_verify_database
            tsi_create_or_verify_database(install_db_url, self.config.install_database_engine_options, app=self)
    if check_migrate_tools:
        from tool_shed.galaxy_install.migrate.check import verify_tools
        if combined_install_database:
            install_database_options = self.config.database_engine_options
        else:
            install_database_options = self.config.install_database_engine_options
        verify_tools(self, install_db_url, config_file, install_database_options)
    from galaxy.model import mapping
    self.model = mapping.init(self.config.file_path, db_url, self.config.database_engine_options, map_install_models=combined_install_database, database_query_profiling_proxy=self.config.database_query_profiling_proxy, object_store=self.object_store, trace_logger=getattr(self, 'trace_logger', None), use_pbkdf2=self.config.get_bool('use_pbkdf2', True), slow_query_log_threshold=self.config.slow_query_log_threshold)
    if combined_install_database:
        log.info("Install    database    targetting    Galaxy's    database    configuration.")
        self.install_model = self.model
    else:
        from galaxy.model.tool_shed_install import mapping as install_mapping
        install_db_url = self.config.install_database_connection
        log.info(('Install    database    using    its    own    connection    %s' % install_db_url))
        install_db_engine_options = self.config.install_database_engine_options
        self.install_model = install_mapping.init(install_db_url, install_db_engine_options)
