Skip to content

Commit

Permalink
Fixed router so that it tightly constrains migrations so monitor tabl…
Browse files Browse the repository at this point in the history
…e migrations happen only on the monitors database, and only monitor table migrations happen on the monitors database
  • Loading branch information
york-stsci committed Feb 26, 2024
1 parent 2680c2e commit d760589
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions jwql/website/apps/jwql/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d760589

Please sign in to comment.