Skip to content

Commit

Permalink
Raise exception on already migrated databases
Browse files Browse the repository at this point in the history
  • Loading branch information
mmulich authored and karenc committed Jan 28, 2021
1 parent cb2ec2a commit ee15f18
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion wbia/dtool/copy_sqlite_to_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
DEFAULT_CHECK_MIN = 10


class AlreadyMigratedError(Exception):
"""Raised when the database has already been migrated"""


class SqliteDatabaseInfo:
def __init__(self, db_dir_or_db_uri):
self.engines = {}
Expand Down Expand Up @@ -522,8 +526,9 @@ def migrate(sqlite_uri: str, postgres_uri: str):
pg_engine = create_engine(postgres_uri)

if not compare_databases(sl_info, pg_info, exact=False):
pass
logger.info(f'{sl_info} already migrated to {pg_info}')
# TODO: migrate missing bits here
raise AlreadyMigratedError()

if schema_name in pg_info.get_schema():
logger.warning(f'Dropping schema "{schema_name}"')
Expand Down

0 comments on commit ee15f18

Please sign in to comment.