コード例 #1
0
 def teardown():
     try:
         db.engine.execute('DROP TABLE vulnerability CASCADE')
     except Exception:
         pass
     try:
         db.engine.execute('DROP TABLE vulnerability_template CASCADE')
     except Exception:
         pass
     db.drop_all()
コード例 #2
0
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(f'DROP TABLE {table} CASCADE')
        except Exception as ex:
            print(ex)
    db.drop_all()

    # db.create_all()
    # Ugly hack to create tables and also setting alembic revision
    conn_string = faraday.server.config.database.connection_string
    InitDB()._create_tables(conn_string)
コード例 #3
0
ファイル: reset_db.py プロジェクト: zack7wong/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 faraday.server.config
    conn_string = faraday.server.config.database.connection_string
    from faraday.server.commands.initdb import InitDB
    InitDB()._create_tables(conn_string)