环回 4 警告:关系数据库不支持 {strict: false} 模式。 {strict: true} 模式将为模型地址设置
loopback 4 WARNING: relational database doesn't support {strict: false} mode. {strict: true} mode will be set for model Address instead
我从环回收到此警告 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
被关系数据库忽略。从模型装饰器中删除该设置是安全的。
进一步阅读:
我从环回收到此警告 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
被关系数据库忽略。从模型装饰器中删除该设置是安全的。
进一步阅读: