Loopback relations with custom field

Multi tool use
up vote
0
down vote
favorite
Any idea how , in Looback 4, I could have a @belongsTo decorator on a field, along with specifying property details (such as making it a primary key, specifying the default or if it's required, etc.)
It appears that the @belongsTo decorator also implements the @property decorator. But I'm thinking there's got to be an already existing way to do this without implementing a custom decorator, since it's a very common thing to do.
Update
Managed to get it working (kind-of).
Actually added a @belongsTo property referring to the target object.
But now the automigrate is creating it as a TEXT column in the database. Any ideas?
Thanks!
mysql node.js loopbackjs
add a comment |
up vote
0
down vote
favorite
Any idea how , in Looback 4, I could have a @belongsTo decorator on a field, along with specifying property details (such as making it a primary key, specifying the default or if it's required, etc.)
It appears that the @belongsTo decorator also implements the @property decorator. But I'm thinking there's got to be an already existing way to do this without implementing a custom decorator, since it's a very common thing to do.
Update
Managed to get it working (kind-of).
Actually added a @belongsTo property referring to the target object.
But now the automigrate is creating it as a TEXT column in the database. Any ideas?
Thanks!
mysql node.js loopbackjs
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Any idea how , in Looback 4, I could have a @belongsTo decorator on a field, along with specifying property details (such as making it a primary key, specifying the default or if it's required, etc.)
It appears that the @belongsTo decorator also implements the @property decorator. But I'm thinking there's got to be an already existing way to do this without implementing a custom decorator, since it's a very common thing to do.
Update
Managed to get it working (kind-of).
Actually added a @belongsTo property referring to the target object.
But now the automigrate is creating it as a TEXT column in the database. Any ideas?
Thanks!
mysql node.js loopbackjs
Any idea how , in Looback 4, I could have a @belongsTo decorator on a field, along with specifying property details (such as making it a primary key, specifying the default or if it's required, etc.)
It appears that the @belongsTo decorator also implements the @property decorator. But I'm thinking there's got to be an already existing way to do this without implementing a custom decorator, since it's a very common thing to do.
Update
Managed to get it working (kind-of).
Actually added a @belongsTo property referring to the target object.
But now the automigrate is creating it as a TEXT column in the database. Any ideas?
Thanks!
mysql node.js loopbackjs
mysql node.js loopbackjs
edited Nov 14 at 20:49
marc_s
565k12610911243
565k12610911243
asked Nov 10 at 14:44
overburn
798316
798316
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240051%2floopback-relations-with-custom-field%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
U4Pjq,Wb JWAthTKKO80UW K9U RLSehstjj 6 mW