コード例 #1
0
def create_tables():
    with app.app_context():
        # Ugly hack to create tables and also setting alembic revision
        import server.config
        conn_string = server.config.database.connection_string
        from server.commands.initdb import InitDB
        InitDB()._create_tables(conn_string)
        click.echo(
            click.style('Tables created successfully!', fg='green', bold=True))
コード例 #2
0
def initdb(choose_password):
    with app.app_context():
        InitDB().run(choose_password=choose_password)
        couchdb_config_present = server.config.couchdb
        if couchdb_config_present and couchdb_config_present.user and couchdb_config_present.password:
            print('Importing data from CouchDB, please wait...')
            ImportCouchDB().run()
            print(
                'All users from CouchDB were imported. You can login with your old username/password to faraday now.'
            )
コード例 #3
0
ファイル: reset_db.py プロジェクト: xemoe/faraday
def reset_db_all():
    # It might be  required to do a cascade delete to correctly the
    # vulnerability table
    for table in ('vulnerability', 'vulnerability_template', 'comment',
                  'faraday_user'):
        try:
            db.engine.execute('DROP TABLE {} CASCADE'.format(table))
        except:
            pass
    db.drop_all()

    # db.create_all()
    # Ugly hack to create tables and also setting alembic revision
    import server.config
    conn_string = server.config.database.connection_string
    from server.commands.initdb import InitDB
    InitDB()._create_tables(conn_string)