Encountering a build error :
Unable to start server due to the following SequelizeDatabaseError: syntax error at or near "SERIAL"
This issue arises only when using the autoIncrement=true parameter for 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'
});
}
Running Sequelize version 3.30.4 and postgreSQL version 9.6.
The intention is to set autoIncrement to true in order to generate UUID with postgreSQL uuid_generate_v4().