From e77e41fb6d23c7aa2afcb10f6f99ba76d267fffc Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 12 Feb 2018 13:33:48 -0500 Subject: [PATCH] move migrators to lbrynet.database, remove lbrynet.db_migrator --- lbrynet/{db_migrator => database}/__init__.py | 0 lbrynet/database/migrator/__init__.py | 0 .../migrator}/dbmigrator.py | 15 +++++++++------ .../migrator}/migrate1to2.py | 0 .../migrator}/migrate2to3.py | 0 .../migrator}/migrate3to4.py | 0 .../migrator}/migrate4to5.py | 0 7 files changed, 9 insertions(+), 6 deletions(-) rename lbrynet/{db_migrator => database}/__init__.py (100%) create mode 100644 lbrynet/database/migrator/__init__.py rename lbrynet/{db_migrator => database/migrator}/dbmigrator.py (56%) rename lbrynet/{db_migrator => database/migrator}/migrate1to2.py (100%) rename lbrynet/{db_migrator => database/migrator}/migrate2to3.py (100%) rename lbrynet/{db_migrator => database/migrator}/migrate3to4.py (100%) rename lbrynet/{db_migrator => database/migrator}/migrate4to5.py (100%) diff --git a/lbrynet/db_migrator/__init__.py b/lbrynet/database/__init__.py similarity index 100% rename from lbrynet/db_migrator/__init__.py rename to lbrynet/database/__init__.py diff --git a/lbrynet/database/migrator/__init__.py b/lbrynet/database/migrator/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/lbrynet/db_migrator/dbmigrator.py b/lbrynet/database/migrator/dbmigrator.py similarity index 56% rename from lbrynet/db_migrator/dbmigrator.py rename to lbrynet/database/migrator/dbmigrator.py index 2e8677345..e5f141f3a 100644 --- a/lbrynet/db_migrator/dbmigrator.py +++ b/lbrynet/database/migrator/dbmigrator.py @@ -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 diff --git a/lbrynet/db_migrator/migrate1to2.py b/lbrynet/database/migrator/migrate1to2.py similarity index 100% rename from lbrynet/db_migrator/migrate1to2.py rename to lbrynet/database/migrator/migrate1to2.py diff --git a/lbrynet/db_migrator/migrate2to3.py b/lbrynet/database/migrator/migrate2to3.py similarity index 100% rename from lbrynet/db_migrator/migrate2to3.py rename to lbrynet/database/migrator/migrate2to3.py diff --git a/lbrynet/db_migrator/migrate3to4.py b/lbrynet/database/migrator/migrate3to4.py similarity index 100% rename from lbrynet/db_migrator/migrate3to4.py rename to lbrynet/database/migrator/migrate3to4.py diff --git a/lbrynet/db_migrator/migrate4to5.py b/lbrynet/database/migrator/migrate4to5.py similarity index 100% rename from lbrynet/db_migrator/migrate4to5.py rename to lbrynet/database/migrator/migrate4to5.py