sequelize / sequelize-auto

Automatically generate bare sequelize models from your database.
2.9k stars 527 forks source link

Text default value not escaped when extracted from custom type #660

Open paslo22 opened 8 months ago

paslo22 commented 8 months ago

Hey! We are using this lib to generate ours models and works great! But we found the following issue:

CREATE TYPE test_source AS ENUM ('first', 'second');

CREATE TABLE test
(
    whatever test_source[] DEFAULT '{first}'
);

The model created is:

whatever: {
  type: DataTypes.ARRAY(DataTypes.ENUM("first","second")),
  defaultValue: [first]
}

As far as I understand, the default value should be:

  defaultValue: ["first"]