示例#1
0
def update_db(update=True):
    db_connection = DatabaseConnection(database=options.sql_database,
                                   hostname=options.sql_host,
                                   port=options.sql_port,
                                   username=options.sql_user,
                                   password=options.sql_password,
                                   dialect=options.sql_dialect)
    alembic_cfg = Config('alembic/alembic.ini')
    alembic_cfg.attributes['configure_logger'] = False
    alembic_cfg.set_main_option('sqlalchemy.url', unquote_plus(str(db_connection)))
    if update:
        command.upgrade(alembic_cfg, "head")
    else:
        command.stamp(alembic_cfg, "head")
示例#2
0
def update_db(update=True):
    db_connection = DatabaseConnection(database=options.sql_database,
                                   hostname=options.sql_host,
                                   port=options.sql_port,
                                   username=options.sql_user,
                                   password=options.sql_password,
                                   dialect=options.sql_dialect)
    alembic_cfg = Config('alembic/alembic.ini')
    alembic_cfg.attributes['configure_logger'] = False
    alembic_cfg.set_main_option('sqlalchemy.url', unquote_plus(str(db_connection)))
    if update:
        command.upgrade(alembic_cfg, "head")
    else:
        command.stamp(alembic_cfg, "head")
示例#3
0
def update_db(update=True):
    logging.info("Checking for Database Updates...")
    db_connection = DatabaseConnection(
        database=options.sql_database,
        hostname=options.sql_host,
        port=options.sql_port,
        username=options.sql_user,
        password=options.sql_password,
        dialect=options.sql_dialect,
    )
    alembic_cfg = Config("alembic/alembic.ini")
    alembic_cfg.attributes["configure_logger"] = False
    alembic_cfg.set_main_option("sqlalchemy.url", unquote(str(db_connection)))
    if update:
        command.upgrade(alembic_cfg, "head")
    else:
        command.stamp(alembic_cfg, "head")