Ian Jamieson
Ian Jamieson

Reputation: 169

Sailsjs not outputting bigint

I'm trying to display a table in sails from a mysql table using the mysql-adapter The ID's in the table are in the following format

14482773051001000000
14482773051001000001
14482773051001000002

But sails is spitting out every ID like

14482773051001000000
14482773051001000000
14482773051001000000

Basically replacing all the last digits with 0.

I've tried autoPK false and setting size to 64 for a bigint, but to no avail.

My attributes are currently set like so:

 autoPK: false,
 schema: true,

  attributes: {
    id: {
  type: 'integer',
      size: 64,
      unique: true,
      autoIncrement:true,
      primaryKey: true
    },

Can anybody help? :/


Answer

Answer was to turn on supportBigNumbers: true via the MysqlAdapter

myMysqlConnection: { adapter: 'sails-mysql', host: '192.168.x.x', user: 'username', password: 'password', database: 'myDb', supportBigNumbers: true },

Thanks to @japel https://github.com/japel on gitter

Upvotes: 1

Views: 184

Answers (1)

Ian Jamieson
Ian Jamieson

Reputation: 169

Answer was to turn on supportBigNumbers: true via the MysqlAdapter

myMysqlConnection: {
  adapter: 'sails-mysql',
  host: '192.168.x.x',
  user: 'username',
  password: 'password',
  database: 'myDb',
  supportBigNumbers: true
},

Thanks to @japel https://github.com/japel on gitter

Upvotes: 1

Related Questions