Skip to content

Postgres Migration: ERROR: syntax error at or near "UNSIGNED" #9738

@sshaw

Description

@sshaw

What are you doing?

Trying to run a migration against Postgres

'use strict';
module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable('Events', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER.UNSIGNED
      },
      type: {
        allowNull: false,
        type: Sequelize.TINYINT.UNSIGNED
      }
    });
  },
  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable('Events');
  }
};

What do you expect to happen?

Migration to successfully run An error about TINYINT not being supported.

What is actually happening?

== 20180417181241-create-events: migrating =======
(sequelize) Warning: PostgreSQL does not support INTEGER with options. Plain `INTEGER` will be used instead., '
>> Check:', http://www.postgresql.org/docs/9.4/static/datatype.html

ERROR: syntax error at or near "UNSIGNED"

If I remove unsigned I get an error about TINYINT not being supported by Postgres (which is expected).

Versions

Postgres 10.4
Sequelize CLI [Node: 9.5.0, CLI: 4.0.0, ORM: 4.37.6]

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugDEPRECATED: replace with the "bug" issue type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions