我从环回收到此警告WARNING: relational database doesn't support {strict: false} mode. {strict: true} mode will be set for model Address instead.
这是模型
import { Entity, model, property, belongsTo, hasMany} from '@loopback/repository';
import { Users } from './users.model';
import {Orders} from './orders.model';
@model({ settings: { strict: false } })
export class Address extends Entity {
@property({
type: 'number',
id: true,
generated: true,
})
address_id?: number;
@property({
type: 'string',
})
default?: string;
@belongsTo(() => Users)
user_id: number;
@hasMany(() => Orders, {keyTo: 'address_id'})
orders: Orders[];
// Define well-known properties here
// Indexer property to allow additional data
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[prop: string]: any;
constructor(data?: Partial<Address>) {
super(data);
}
}
export interface AddressRelations {
// describe navigational properties here
}
export type AddressWithRelations = Address & AddressRelations;
我从昨天开始收到这个警告。那是什么意思?我是否需要将严格设置更改为 true
添加此警告是为了警告关系数据库忽略strict: false
。从模型修饰器中删除该设置是安全的。
延伸阅读:
- https://github.com/strongloop/loopback-datasource-juggler/pull/1817
您只需使用strict: false
更新设置即可。或者,您可以从模仿默认行为的设置中删除strict
选项。