Exemplo n.º 1
0
    def _clean_db(self):
        with db_api_v2.transaction():
            db_api_v2.delete_members()
            db_api_v2.delete_listeners()

        if not cfg.CONF.database.connection.startswith('sqlite'):
            db_sa_base.get_engine().dispose()
Exemplo n.º 2
0
def drop_db():
    global _facade

    try:
        models.Listener.metadata.drop_all(b.get_engine())
        _facade = None
    except Exception as e:
        raise exc.DBException("Failed to drop database: %s" % e)
Exemplo n.º 3
0
def setup_db():
    try:
        models.Listener.metadata.create_all(b.get_engine())
    except sa.exc.OperationalError as e:
        raise exc.DBException("Failed to setup database: %s" % e)