Example #1
0
def reset_db():
    click.echo("Dropping all tables")
    db.drop_all()
    db.session.commit()
    click.echo("Recreating them")
    db.create_all()
    db.session.commit()
    click.echo("Success")
Example #2
0
def client():
    app.config.from_object(Debug)
    with app.app_context():
        db.create_all()
        with app.test_client() as client:
            yield client
        db.drop_all()
        db.engine.dispose()
    os.remove(app.config['DATABASE_FILE'])
Example #3
0
def init_db():
    click.echo("Creating database")
    db.create_all()
    click.echo("Committing change")
    db.session.commit()
    click.echo("Success")