def init_db(): from reddwarf.common import cfg from reddwarf.db import get_db_api from reddwarf.db.sqlalchemy import session CONF = cfg.CONF db_api = get_db_api() db_api.db_sync(CONF) session.configure_db(CONF)
def initialize_database(): from reddwarf.db import get_db_api from reddwarf.instance import models from reddwarf.db.sqlalchemy import session db_api = get_db_api() db_api.drop_db(CONF) # Destroys the database, if it exists. db_api.db_sync(CONF) session.configure_db(CONF) # Adds the image for mysql (needed to make most calls work). models.ServiceImage.create(service_name="mysql", image_id="fake") db_api.configure_db(CONF)
def configure_db(options, *plugins): session.configure_db(options) configure_db_for_plugins(options, *plugins)
def configure_db_for_plugins(options, *plugins): for plugin in plugins: session.configure_db(options, models_mapper=plugin.mapper)
def configure_db_for_plugins(options, *plugins): LOG.debug("Configuring DB with options: %s" % options) if plugins: LOG.debug("Configuring DB with plugins: %s" % plugins) for plugin in plugins: session.configure_db(options, models_mapper=plugin.mapper)