Example #1
0
def migrate_db(db_dir, start, end):
    current = start
    while current < end:
        if current == 1:
            from lbrynet.database.migrator.migrate1to2 import do_migration
        elif current == 2:
            from lbrynet.database.migrator.migrate2to3 import do_migration
        elif current == 3:
            from lbrynet.database.migrator.migrate3to4 import do_migration
        elif current == 4:
            from lbrynet.database.migrator.migrate4to5 import do_migration
        elif current == 5:
            from lbrynet.database.migrator.migrate5to6 import do_migration
        elif current == 6:
            from lbrynet.database.migrator.migrate6to7 import do_migration
        elif current == 7:
            from lbrynet.database.migrator.migrate7to8 import do_migration
        elif current == 8:
            from lbrynet.database.migrator.migrate8to9 import do_migration
        else:
            raise Exception(
                "DB migration of version {} to {} is not available".format(
                    current, current + 1))
        do_migration(db_dir)
        current += 1
        log.info("successfully migrated the database from revision %i to %i",
                 current - 1, current)
    return None
Example #2
0
def migrate_db(db_dir, start, end):
    current = start
    while current < end:
        if current == 1:
            from lbrynet.database.migrator.migrate1to2 import do_migration
        elif current == 2:
            from lbrynet.database.migrator.migrate2to3 import do_migration
        elif current == 3:
            from lbrynet.database.migrator.migrate3to4 import do_migration
        elif current == 4:
            from lbrynet.database.migrator.migrate4to5 import do_migration
        elif current == 5:
            from lbrynet.database.migrator.migrate5to6 import do_migration
        elif current == 6:
            from lbrynet.database.migrator.migrate6to7 import do_migration
        else:
            raise Exception(
                "DB migration of version {} to {} is not available".format(
                    current, current + 1))
        do_migration(db_dir)
        current += 1
    return None