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

After Sequelize v3.13, I cannot make DataTypes.ARRAY(DataTypes.STRING) work in Postgres #5401

Closed
asuwend1 opened this issue Feb 11, 2016 · 6 comments

Comments

@asuwend1
Copy link

Hi,

My model work for sequelize v3.13, but starting with v3.14 and later, it does not work.

          days: {
              type: DataTypes.ARRAY(DataTypes.STRING),
              allowNull: true,
              defaultValue: '{}'
          }

Corresponding postgres datatype (using postgres 9.4): character varying(255)[]
Error:
[TypeError: values.map is not a function]

Is this a regression issue?

@asuwend1 asuwend1 changed the title After Sequelize v3.13, I cannot DataTypes.ARRAY(DataTypes.STRING) does not work in Postgres After Sequelize v3.13, I cannot make DataTypes.ARRAY(DataTypes.STRING) work in Postgres Feb 11, 2016
@mickhansen
Copy link
Contributor

Please include the call you're doing an the entire stack trace, you're giving us extremely little to go on.

@asuwend1
Copy link
Author

Sure. Here's the stack trace:

Trace: [TypeError: values.map is not a function]
    at C:\Users\Administrator\Documents\MyApp\app.js:53:17
    at tryCatcher (C:\Users\Administrator\Documents\MyApp\node_modules\bluebird\js\release\util.js:16:23)
    at Promise.module.exports.Promise._settlePromiseFromHandler (C:\Users\Administrator\Documents\MyApp\node_modules\bluebird\js\release\promise.js:497:31)
    at Promise.module.exports.Promise._settlePromise (C:\Users\Administrator\Documents\MyApp\node_modules\bluebird\js\release\promise.js:554:18)
    at Promise.module.exports.Promise._settlePromise0 (C:\Users\Administrator\Documents\MyApp\node_modules\bluebird\js\release\promise.js:599:10)
    at Promise.module.exports.Promise._settlePromises (C:\Users\Administrator\Documents\MyApp\node_modules\bluebird\js\release\promise.js:678:18)
    at Async._drainQueue (C:\Users\Administrator\Documents\MyApp\node_modules\bluebird\js\release\async.js:125:16)
    at Async._drainQueues (C:\Users\Administrator\Documents\MyApp\node_modules\bluebird\js\release\async.js:135:10)
    at Immediate.__dirname.drainQueues [as _onImmediate] (C:\Users\Administrator\Documents\MyApp\node_modules\bluebird\js\release\async.js:16:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

This happens in both Windows and Mac (platform independent).
The error is triggered by "Promise.map" at Sequelize code lib/model.js around line 1006 (Model.prototype.sync method).

Thank you.

@janmeier
Copy link
Member

Your default value should be an actual array instead of a string: defaultValue: []

@waqasbaig86
Copy link

I am also having issue with Array datatypes with MSSQL , when i updated sequelize version from 5.12.3->6.37.3
Model column:
Subscribe_emailListIds: DataTypes.ARRAY(DataTypes.STRING)

Error: Conversion failed for value string, parameter 9

@WikiRik
Copy link
Member

WikiRik commented May 15, 2024

As far as I know DataTypes.ARRAY(DataTypes.STRING) is only supported for postgres, see https://sequelize.org/docs/v6/other-topics/other-data-types/#arrays-postgresql-only

@waqasbaig86
Copy link

Thanks @WikiRik for your response. I have updated types in my model then.

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

5 participants