Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data types for Array of integers, strings and objects are omitted during the model creation #31

Open
kumarordway opened this issue Feb 9, 2022 · 2 comments

Comments

@kumarordway
Copy link
Contributor

Data types for Array of integers, strings and objects are omitted during the model creation

If the column has the array of integers as the data type it is omitted in the column type.

expected behavior:
The type should be defined for array of integers, or any types of arrays.

@spinlud
Copy link
Owner

spinlud commented Mar 18, 2022

Hi there!
What do you mean by "Array of integers, strings and objects are omitted during the model creation"?

Could you provide an example?

cheers🍺

@kumarordway
Copy link
Contributor Author

In postgress, type of column can be an array of strings or array integers etc. via json objects. For these columns the datatype is missed example here

 @Column({
    field: 'source_id',
    allowNull: true,
    defaultValue: Sequelize.literal("'{}'::integer[]"),
  })
    sourceId?: any;

See that this is missing type in column definition. this needs to be fixed with

@Column({
    field: 'xxx',
    allowNull: true,
    defaultValue: Sequelize.literal("'{}'::integer[]"),
    type: DataType.ARRAY(DataType.INTEGER),
  })
  sourceId?: any;

column definition in postgres information_schema for this column looks like this

 columns_default = "'{}'::integer[]"
 is_nullable = "YES"
 data_type="ARRAY"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants