loopback 4 警告:关系型数据库不支持{strict: false}模式。{strict: true}模式将被设置为模型地址模式。

问题描述 投票:0回答:1

我从loopback收到这个警告 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;

我从昨天才开始收到这个警告。这是什么意思?我是否需要将严格的设置改为真

loopbackjs loopback4
1个回答
1
投票

这是一个警告,是为了警告说 strict: false 是被关系型数据库忽略的。从模型装饰器中删除该设置是安全的。

进一步阅读。

© www.soinside.com 2019 - 2024. All rights reserved.