Пример #1
0
def init_db(argv=sys.argv):
    if len(argv) != 2:
        init_db_usage(argv)

    init_scripts(argv)

    from pyramid_sqlalchemy import engine
    engine.echo = True

    try:
        db_init(engine)
    except DatabaseAlreadyControlledError:
        _log("Database already under version control")
        sys.exit(2)
    else:
        _log("Database now under version control")
        sys.exit(0)
Пример #2
0
def setUpMigrate():
    """ Runs migrations before each test """
    engine = create_engine('sqlite://', echo=True)
    Session.configure(bind=engine)
    db_init(engine)
    db_upgrade(engine)