loopbackio / loopbackio/loopback-next
Setting a foreign key as a nullable key in model file is not working in loopback 4
オープン
まだ誰も着手していません。
bug
- 主要言語
- TypeScript
- スター
- 5.1k
- フォーク
- 1.1k
- 平均マージ
- 2日 21時間
- マージ済み PR(30日)
- 27
説明
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?
Logs
No response
Additional information
No response
Reproduction
not needed as problem is obvious
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
この issue では、BillID の @property および @belongsTo 宣言を含むモデルファイルを特定しています。まず、LoopBack 4 が nullable な外部キーをどのように表現するかを追跡してください。対応が完了した状態とは、サポートされている構成を確認するか、framework の変更点を明確にし、nullable な BillID の動作を検証できた状態です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- nodejs, typescript
- 領域
- api, backend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100