From 0a02d880a213d5dfc6670608c3225367f865c2d9 Mon Sep 17 00:00:00 2001 From: Chris Wild Date: Wed, 17 Aug 2016 22:21:06 +0100 Subject: [PATCH] Fix to prevent meltdown when migrations are not present for a Datastore --- pokemongo_bot/datastore.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pokemongo_bot/datastore.py b/pokemongo_bot/datastore.py index bdd03f9fce..d0f4099d3c 100644 --- a/pokemongo_bot/datastore.py +++ b/pokemongo_bot/datastore.py @@ -54,6 +54,12 @@ def __init__(self, *args, **kwargs): elif not os.path.isdir(str(path)): raise RuntimeError('The migrations directory does not exist') - with DATABASE as conn: + try: migrations = read_migrations(path) BACKEND.apply_migrations(BACKEND.to_apply(migrations)) + except (IOError, OSError): + """ + If `migrations` directory is not present, then whatever is subclassing + us will not have any DB schemas to load. + """ + pass