about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--migrations/auth/20260402_01_Bf8nm-add-user-and-time-tracking-to-resources-table.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/migrations/auth/20260402_01_Bf8nm-add-user-and-time-tracking-to-resources-table.py b/migrations/auth/20260402_01_Bf8nm-add-user-and-time-tracking-to-resources-table.py
index fd1e617..702c418 100644
--- a/migrations/auth/20260402_01_Bf8nm-add-user-and-time-tracking-to-resources-table.py
+++ b/migrations/auth/20260402_01_Bf8nm-add-user-and-time-tracking-to-resources-table.py
@@ -38,7 +38,9 @@ def fetch_a_sysadmin_id(conn, resources_table):
             return tuple(row[0] for row in cursor.fetchall())
 
     if not bool(__admin_id__):
-        __admin_id__ = random.choice(__fetch__())
+        __admins__ = __fetch__()
+        if len(__admins__) > 0:
+            __admin_id__ = random.choice(__admins__)
 
     return __admin_id__