forked from LBRYCommunity/lbry-sdk
move migrators to lbrynet.database, remove lbrynet.db_migrator
This commit is contained in:
parent
5c4c182332
commit
e77e41fb6d
7 changed files with 9 additions and 6 deletions
0
lbrynet/database/migrator/__init__.py
Normal file
0
lbrynet/database/migrator/__init__.py
Normal file
|
@ -5,20 +5,23 @@ def migrate_db(db_dir, start, end):
|
||||||
current = start
|
current = start
|
||||||
while current < end:
|
while current < end:
|
||||||
if current == 1:
|
if current == 1:
|
||||||
from lbrynet.db_migrator.migrate1to2 import do_migration
|
from lbrynet.database.migrator.migrate1to2 import do_migration
|
||||||
do_migration(db_dir)
|
do_migration(db_dir)
|
||||||
elif current == 2:
|
elif current == 2:
|
||||||
from lbrynet.db_migrator.migrate2to3 import do_migration
|
from lbrynet.database.migrator.migrate2to3 import do_migration
|
||||||
do_migration(db_dir)
|
do_migration(db_dir)
|
||||||
elif current == 3:
|
elif current == 3:
|
||||||
from lbrynet.db_migrator.migrate3to4 import do_migration
|
from lbrynet.database.migrator.migrate3to4 import do_migration
|
||||||
do_migration(db_dir)
|
do_migration(db_dir)
|
||||||
elif current == 4:
|
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)
|
do_migration(db_dir)
|
||||||
else:
|
else:
|
||||||
raise Exception(
|
raise Exception("DB migration of version {} to {} is not available".format(current,
|
||||||
"DB migration of version {} to {} is not available".format(current, current+1))
|
current+1))
|
||||||
current += 1
|
current += 1
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Reference in a new issue