syntax error at or near "SERIAL" with autoIncrement only

Viewed 10014

I get the error on build :

Server failed to start due to error: SequelizeDatabaseError: syntax error at or near "SERIAL"

This error ONLY appears when the parameter autoIncrement=true is given to the primary key.

'use strict';

export default function(sequelize, DataTypes) {
  return sequelize.define('Ladder', {
    ladder_id: {
      type: DataTypes.UUID,
      allowNull: false,
      primaryKey: true,
      autoIncrement: true //<------- If commented it works fine
    },
    ladder_name: {
      type: DataTypes.STRING(50),
      allowNull: false,
      unique: true
    },
    ladder_description: {
      type: DataTypes.TEXT,
      allowNull: true
    },
    ladder_open: {
      type: DataTypes.BOOLEAN,
      allowNull: false
    },
    ladder_hidden: {
      type: DataTypes.BOOLEAN,
      allowNull: false
    },
    ladder_creation_date: {
      type: DataTypes.DATE,
      allowNull: false
    },
    ladder_fk_user: {
      type: DataTypes.INTEGER,
      allowNull: false
    },
    ladder_fk_game: {
      type: DataTypes.UUID,
      allowNull: false
    },
    ladder_fk_platforms: {
      type: DataTypes.ARRAY(DataTypes.UUID),
      allowNull: false
    }

  },
    {
      schema: 'ladder',
      tableName: 'ladders'
    });
}

I have Sequelize 3.30.4 and postgreSQL 9.6.

I want autoIncrement at true because I am generating the UUID with postgreSQL uuid_generate_v4().

3 Answers
child_id: {
    primaryKey: true,
    autoIncrement: true,
    type: Sequelize.INTEGER
},
parent_id: {
    references: {
        model: 'parent',
        key: 'parent_id'
    },
    type: Sequelize.INTEGER
}
Related