Skip to content

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

Closed

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]

Activity

  1. sshaw commented on Jul 29, 2018

    @sshaw
    Author

    Note that if TINYINT.UNSIGNED is changed to SMALLINT.UNSIGNED, there is no syntax error.

    #1157 too.

  2. added
    type: bug
    on Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions