loopbackjsloopback4

loopback 4 WARNING: relational database doesn't support {strict: false} mode. {strict: true} mode will be set for model Address instead


I am getting this warning from loopback WARNING: relational database doesn't support {strict: false} mode. {strict: true} mode will be set for model Address instead.

here is model

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;

I have started to get this warning from yesterday only. What does that mean? Do I need to change strict settings to true


Solution

  • This is a warning that was added to warn that strict: false is ignored by relational databases. It is safe to remove that setting from the model decorator.

    Further reading: