sails.jssails-postgresql

SailsJs Models long integer support with postgresql


I'm having issues with a Sails application running with a PostgreSQL database. I needed to insert an 11 digits integer, but I can't find a simple way to tweak my models for this.

Edit 1 here is an example of a model :

/**
 * Phone.js
 *
 * @docs        :: http://sailsjs.org/#!documentation/models
 */

module.exports = {

    attributes: {
        number: {
            type: 'integer',
            required: true,
            minLength: 9
        }
    }
};

Is there a way (using the ORM) to change that integer into a BIGINT in Postgre so I don't get ERROR: integer out of rage when inserting?


Solution

  • According to this, yo should just be able to define "bigint" as the type

    https://github.com/balderdashy/sails-postgresql/blob/master/lib/utils.js#L241

    also supports float, real, smallint ect . . .