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
[MSSQL]DataTypes.STRING should be Varchar or NVarchar ? #6036
Comments
|
version 4.42.0 |
@komeilshahmoradi check out this issue #8533 might help guide you on how to extend data types to your liking. I am not sure why SequelizeJS decided to opt for Alternatively, if you don't mind using sequelize/lib/dialects/mssql/data-types.js Line 175 in 16b39c6
Reopening because it is an issue |
version: 4.42.0 I have the same problem. I need to use varchar instead of nvarchar. I execute raw queries through sequelize. The replacements always converts to nvarchar and it is a performance bottleneck for my operation. The regular query with varchar runs in under a second and the one with nvarchar runs anywhere from 30 to 45 seconds. I tried overriding the tosql() method, but I couldn't get the extended version to be used in the program. Any help on that is much appreciated. Below is the code .
But ideally, adding an option to choose between nvarchar and varchar will be much helpful. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂 |
I am using "sequelize": "^5.21.5" |
Any update on this issue? Its impacting application performace. |
@ephys I think you can answer this |
Issue is
Above code executing following query Note: path is varchar data type in MSSQL DataBase |
I don't want to change what In the meantime, there is a workaround you can use that we just documented. You can use As for generating |
@ephys suggestions are not working. We are using the 5.22.4 version. Do we need to upgrade this to the latest version? |
I did a quick test in a SSCCE running with mssql and the following code: class User extends Model {}
User.init({
firstName: 'VARCHAR(50)',
}, {
sequelize,
});
await sequelize.sync({ force: true }); Which resulted in the following SQL:
I was running it using Sequelize 6, it may be the case that this is not supported in Sequelize 5. There is a small number of breaking changes in Sequelize 6, I definitely recommend upgrading: https://sequelize.org/master/manual/upgrade-to-v6.html |
I have tested this with the latest version
and i am using this model as
This is producing following query
The issue is with the N char after like in query. How to fix this? |
@nareshy-quisitive That part is tracked over here #9107 but we won't be able to do that until we have a proper non-n varchar type, which I opened a RFC for here #14259 |
version:3.19.3
http://docs.sequelizejs.com/en/latest/api/datatypes/
according to the docs, DataTypes.STRING should be map to Varchar. but i got nvarchar in mssql ?
The text was updated successfully, but these errors were encountered: