You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Intelligent association typing and multikey support
Should allow associations to automatically create foreign keys of the
same time as the primary key(s) of the model they reference and
also allowing associations to automatically create the
required foreign keys for models which have multiple primary key fields.
This change requires at least version 0.1.5 of node-sql-query to support
the multi-field join functionality used.
There is a change in the way chained finds are executed for hasAccessors,
meaning that instead of passing the id of the object you pass the entire
object. This is to support objects with multiple primary key identifiers.
```js
Model.find().hasSomething(TheSomething).all(function(err, somethings) {
});
```
If you prefer to use another name for the field (owner_id) you can change this parameter in the settings.
923
934
924
935
```js
925
-
db.settings.set("properties.association_key", "id_{name}"); // {name} will be replaced by 'owner' in this case
936
+
db.settings.set("properties.association_key", "{field}_{name}"); // {name} will be replaced by 'owner' and {field} will be replaced by 'id' in this case
926
937
```
927
938
928
939
**Note: This has to be done before the association is specified.**
0 commit comments