sequelize-auto icon indicating copy to clipboard operation
sequelize-auto copied to clipboard

Incorrect import of default value for jsonb

Open MichaelLeeHobbs opened this issue 3 years ago • 2 comments

DDL peer_review_config jsonb default '{"frequency": 100}'::jsonb not null,

Import

    peer_review_config: {
      type: DataTypes.JSONB,
      allowNull: false,
      defaultValue: {\"frequency\": 100}
    },

Expected

    peer_review_config: {
      type: DataTypes.JSONB,
      allowNull: false,
      defaultValue: {"frequency": 100}
    },

MichaelLeeHobbs avatar Jun 23 '22 14:06 MichaelLeeHobbs

I got the same issue

chiendv avatar Aug 29 '22 07:08 chiendv

+1 The resulting error is hard to debug:

SyntaxError: Invalid or unexpected token
    at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:119:18)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:468:14)

mariusa avatar Apr 14 '23 16:04 mariusa