def migrate_db(argv=sys.argv): if len(argv) < 2 or len(argv) > 3: migrate_db_usage(argv) init_scripts(argv) if len(argv) == 2: version = None else: version = argv[2] from pyramid_sqlalchemy import engine engine.echo = True try: db_upgrade(engine, version=version) except KeyError, e: _log("Version '%s' not found" % str(version)) sys.exit(2)
def setUpMigrate(): """ Runs migrations before each test """ engine = create_engine('sqlite://', echo=True) Session.configure(bind=engine) db_init(engine) db_upgrade(engine)