Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes:
add a model registry from model symbol to set of namespaces that defines it. Use this registry to look up when model is used as a symbol, eg
(db/select 'Foo :id 1)
.Suggested breaking change
Before this change, defining multiple models with the same name and querying by model symbol would always resolve to the model defined in the "conventional" namespace as constructed with
model/root-namespace
. If there were multiple models defined in "unconventional" locations, it would never find either of them. The registry is checked after the inferred namespace to preserve this behavior. But it might be better to change this behavior. Rather than allowing multiple model definitions like this, perhaps we could check the inferred location and also the registered locations and ensure we do not have an ambiguous model reference.There is probably a small chance of this happening but having models findable in non-standard locations might increase the odds of it a little bit.
ie, if you define a normal model
User
in the conventional location ((defmodel User :production_user_table)
) and a test file defines(defmodel User :test_user_table)
, usages of'User
as a symbol would resolve to the production user table. It might be better to throw in this case, even if this is a remote scenario.