def reset_data():
    logger.info('Resetting PostgreSQL DB')

    setup_app()

    # Rebuild the DB
    db.drop_all()
    db.create_all()

    add_users_and_roles_to_userstore(user_datastore, get_admin_user(),
                                     get_admin_role())

    # Clear the connection
    db.session.remove()
    db.get_engine(app).dispose()
Example #2
0
def reset_data():
    logger.info('Resetting PostgreSQL DB')

    setup_app()

    # Rebuild the DB
    db.drop_all()
    db.create_all()

    default_tenant = Tenant(name=instance.default_tenant_name)
    db.session.add(default_tenant)

    add_users_and_roles_to_userstore(user_datastore, utils.get_admin_user(),
                                     get_admin_role(), default_tenant)

    # Clear the connection
    db.session.remove()
    db.get_engine(app).dispose()
def close_session(app):
    db.session.remove()
    db.get_engine(app).dispose()
def close_session(app):
    db.session.remove()
    db.get_engine(app).dispose()