-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
upsert fails when a spatial field is used on MSSQL #11244
Comments
This is happening with postgres too. Using To be more specific: In migration: await queryInterface.createTable('projects', {
geo: {
type: Sequelize.GEOGRAPHY('POINT', 4326),
},
...
} In seeds: await queryInterface.bulkInsert('projects', [
{
geo: {
type: 'Point',
coordinates: [-0.09, 51.505],
},
}
...
]) when I run
|
@papb I think the docs also need improvement, it's not clear how to insert a point if one declares a field as |
Ok, so when using with await queryInterface.bulkInsert('projects', [
{
geo: {
type: 'Point',
coordinates: [-0.09, 51.505],
},
}
...
]) to await queryInterface.bulkInsert('projects', [
{
geo: 'POINT(-0.09 51.505)'
}
...
]) seems to work. |
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂 |
What are you doing?
Calling upsert on a model with a spatial field
To Reproduce
Steps to reproduce the behavior:
What do you expect to happen?
Object should be translated into a T-SQL geometry function (es. ST_GeomFromText( ..., ... )
What is actually happening?
Raw value it's used instead to escape using model attribute info.
This happens because at
sequelize/lib/dialects/mssql/query-generator.js
Line 420 in f3b5f99
Sequelize returns this error message
Error: Invalid value { type: 'Point', coordinates: [ 0, 0 ] }
Changing above linked code line with
all works fine.
Environment
Dialect:
Dialect tedious version: 5.0.3
Database version: SQL SERVER 2017 - 14.0.3045.24
Sequelize version: 4.44.2
Node Version: 8.11.2
OS: Ubuntu 14
Tested with latest release:
The text was updated successfully, but these errors were encountered: