sequelize / sequelize-auto

Automatically generate bare sequelize models from your database.
2.91k stars 529 forks source link

Incorrect import of default value for jsonb #612

Open MichaelLeeHobbs opened 2 years ago

MichaelLeeHobbs commented 2 years ago

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}
    },
chiendv commented 2 years ago

I got the same issue

mariusa commented 1 year ago

+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)