diff --git a/bigchaindb/backend/schema.py b/bigchaindb/backend/schema.py index 92b43a73..6c5b0720 100644 --- a/bigchaindb/backend/schema.py +++ b/bigchaindb/backend/schema.py @@ -58,15 +58,15 @@ def drop_database(connection, dbname): raise NotImplementedError -def init_database(conn=None, dbname=None): +def init_database(connection=None, dbname=None): """Initialize the configured backend for use with BigchainDB. Creates a database with :attr:`dbname` with any required tables and supporting indexes. Args: - conn (:class:`~bigchaindb.backend.connection.Connection`): an existing - connection to use to initialize the database. + connection (:class:`~bigchaindb.backend.connection.Connection`): an + existing connection to use to initialize the database. Creates one if not given. dbname (str): the name of the database to create. Defaults to the database name given in the BigchainDB @@ -77,9 +77,9 @@ def init_database(conn=None, dbname=None): given :attr:`dbname` already exists as a database. """ - conn = conn or connect() + connection = connection or connect() dbname = dbname or bigchaindb.config['database']['name'] - create_database(conn, dbname) - create_tables(conn, dbname) - create_indexes(conn, dbname) + create_database(connection, dbname) + create_tables(connection, dbname) + create_indexes(connection, dbname) diff --git a/bigchaindb/commands/bigchain.py b/bigchaindb/commands/bigchain.py index d0dba048..1f1a0dcc 100644 --- a/bigchaindb/commands/bigchain.py +++ b/bigchaindb/commands/bigchain.py @@ -138,7 +138,7 @@ def _run_init(): # Try to access the keypair, throws an exception if it does not exist b = bigchaindb.Bigchain() - schema.init_database(b.connection) + schema.init_database(connection=b.connection) logger.info('Create genesis block.') b.create_genesis_block()