def allow_relation(self, obj1, obj2, **hints):  # type: ignore[no-untyped-def]
        """
        Relations between objects are allowed if both objects are
        in the primary/replica pool.
        """
        db_set = {
            "default",
            *[f"replica_{i}" for i in range(1, settings.NUM_DB_REPLICAS + 1)],
            *[
                f"cross_region_replica_{i}"
                for i in range(1, settings.NUM_CROSS_REGION_DB_REPLICAS + 1)
            ],
        }
        if obj1._state.db in db_set and obj2._state.db in db_set:
            return True
        return None

        Relations between objects are allowed if both objects are
        in the primary/replica pool.
        
api/app/routers.py