Skip to content

How to specify dataType for relations (ie : @belongsTo()) #8476

Answered by achrinza
MartialSeron asked this question in Q&A
Discussion options

You must be logged in to vote

The @belongsTo() decorator accepts PropertyDefinition as the third parameter. Hence it's possible to do this:

@belongsTo(
  () => Group,
  {name: 'groupTest'},
  {
    mysql: {
      dataType: 'int unsigned',
    },
  },
)
group: number;

More information can be found in the API docs.

Hope it helps!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MartialSeron
Comment options

Answer selected by MartialSeron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants