move migrators to lbrynet.database, remove lbrynet.db_migrator

This commit is contained in:
Jack Robison 2018-02-12 13:33:48 -05:00
parent 5c4c182332
commit e77e41fb6d
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
7 changed files with 9 additions and 6 deletions

View file

View file

@ -5,20 +5,23 @@ def migrate_db(db_dir, start, end):
current = start
while current < end:
if current == 1:
from lbrynet.db_migrator.migrate1to2 import do_migration
from lbrynet.database.migrator.migrate1to2 import do_migration
do_migration(db_dir)
elif current == 2:
from lbrynet.db_migrator.migrate2to3 import do_migration
from lbrynet.database.migrator.migrate2to3 import do_migration
do_migration(db_dir)
elif current == 3:
from lbrynet.db_migrator.migrate3to4 import do_migration
from lbrynet.database.migrator.migrate3to4 import do_migration
do_migration(db_dir)
elif current == 4:
from lbrynet.db_migrator.migrate4to5 import do_migration
from lbrynet.database.migrator.migrate4to5 import do_migration
do_migration(db_dir)
elif current == 5:
from lbrynet.database.migrator.migrate5to6 import do_migration
do_migration(db_dir)
else:
raise Exception(
"DB migration of version {} to {} is not available".format(current, current+1))
raise Exception("DB migration of version {} to {} is not available".format(current,
current+1))
current += 1
return None