From d7605892707fc3f50077c8dd9fb9eb7d7cd1870e Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Mon, 26 Feb 2024 15:58:51 -0500 Subject: [PATCH] Fixed router so that it tightly constrains migrations so monitor table migrations happen only on the monitors database, and only monitor table migrations happen on the monitors database --- jwql/website/apps/jwql/router.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jwql/website/apps/jwql/router.py b/jwql/website/apps/jwql/router.py index 5b08fa440..dbfd9f3a2 100644 --- a/jwql/website/apps/jwql/router.py +++ b/jwql/website/apps/jwql/router.py @@ -59,6 +59,11 @@ def allow_migrate(self, db, app_label, model_name=None, **hints): Make sure the monitors apps only appear in the 'monitors' database. """ model_names = [name.replace("_", "") for name in MONITOR_TABLE_NAMES] - if app_label == 'jwql' and model_name in model_names: - return db == "monitors" + if app_label == 'jwql': + if model_name in model_names: + if db == "monitors": + return True + return False + elif db == "monitors": + return False return None