domasx2 / sequelize-fixtures

Load data from json, yaml or js to sequelize
301 stars 83 forks source link

Fix for loading geography fields. #117

Closed NikitaKrasavtsev closed 4 years ago

NikitaKrasavtsev commented 4 years ago

Currently if there is a field of geography type defined like this:

geoPosition: { type: GEOGRAPHY('POINT', 4326), },

and you try to load it in fixtures like this:

.... "geoPosition": {"type": "Point", "coordinates": [39.807222, -76.984722]}, ...

the query that sequelize-fixtures generate to check if the record is in DB contains the following fragment in the WHERE section:

...("ResidentialRealEstate"."geoPosition" = ST_GeomFromGeoJSON('{"type":"Point"}') AND "ResidentialRealEstate"."geoPosition" = ST_GeomFromGeoJSON('{"coordinates":[39.807222,-76.984722]}'))...

This should be handled in the same manner as geometry field.

domasx2 commented 4 years ago

hi, thanks!