0

Describe the bug

I want to set up a field that is defined as a foreign key, but also supports the ability to be null. In the model file, I have this already

  @belongsTo(() => Bill, { keyTo: 'BillID', name: 'Bill' })
  BillID: Number;

But what I want to do is something like this

  @property({
    type: Number,
    required: false,
    jsonSchema: { nullable: true },
    mssql: { "columnName": "BillID", "dataType": "int", "dataPrecision": null, "dataScale": null, "nullable": "YES" },
  })
  @belongsTo(() => Bill, { keyTo: 'BillID', name: 'Bill' })
  BillID: Number;

but that does not work. How can I set this up?

omega
  • 40,311
  • 81
  • 251
  • 474

0 Answers0