0

sails 1.2.4, waterline 0.13.6, sails-postgresql 1.0.2, npm 6.14.4, macOS 10.15.4

My final objective is to suppress the warning provided by waterline because I have a field configured in sails' model as 'number', and it is configured as 'bigint' in postgresql. I know about the mismatch, but this is what I want, since I'm using this field for date-time in milliseconds, I'm sure the values won't exceed the size of 'number' (so no arm in using 'bigint'). The 'real' field created by the adapter in postgresql would not fit for the purpose.

Everything is working fine, except sails produces the following log that is pretty verbose:

You are seeing this warning because there are records in your database that don't match up with your models. This is often the result of a model definition being changed without also migrating leftover data. But it could also be because records were added or modified in your database from somewhere outside of Sails/Waterline (e.g. phpmyadmin, or another app). In either case, to make this warning go away, you have a few options. First of all, you could change your model definition so that it matches the existing records in your database. Or you could update/destroy the old records in your database; either by hand, or using a migration script.

(For example, to wipe all data, you might just use migrate: drop.)

More rarely, this warning could mean there is a bug in the adapter itself. If you believe that is the case, then please contact the maintainer of this adapter by opening an issue, or visit http://sailsjs.com/support for help.

I found that exists the 'skipRecordVerification' option with waterline and I appended '.meta({skipRecordVerification: true})' to all the queries, but the warning is still produced each time the application access the DB.

Any idea to make it work with 'skipRecordVerification' or any other way to suppress the warning?

marxxx
  • 1
  • 1

1 Answers1

0

I think there is no global option for now to resolve this issue, it's really annoying. I managed to create a workaround as bellow:

  1. install the plugin sails-hook-custom-blueprints
  2. override the blueprints functions files in your api/blueprints folder you can find original code here
  3. add the following code to the blueprint after declaring

var queryOptions = parseBlueprintOptions(req);

if (queryOptions.meta)
    queryOptions.meta['skipRecordVerification'] = true;
else
    queryOptions.meta = { 'skipRecordVerification': true };

I hope this will be useful for now until sails developers create a global option in the model settings.

OPADA-Eng
  • 45
  • 1
  • 2
  • 10