Revert "switch long and lat for geopoint type"

This reverts commit dd5bfb3f82.
This commit is contained in:
biniam 2017-05-31 10:30:00 -04:00
parent 361f7585b0
commit 0187f0434b
2 changed files with 4 additions and 29 deletions

View File

@ -361,7 +361,7 @@ MySQL.prototype.toColumnValue = function(prop, val) {
if (prop.type.name === 'GeoPoint') { if (prop.type.name === 'GeoPoint') {
return new ParameterizedSQL({ return new ParameterizedSQL({
sql: 'Point(?,?)', sql: 'Point(?,?)',
params: [val.lng, val.lat], params: [val.lat, val.lng],
}); });
} }
if (prop.type === Buffer) { if (prop.type === Buffer) {
@ -422,8 +422,8 @@ MySQL.prototype.fromColumnValue = function(prop, val) {
case 'GeoPoint': case 'GeoPoint':
case 'Point': case 'Point':
val = { val = {
lng: val.x, lat: val.x,
lat: val.y, lng: val.y,
}; };
break; break;
case 'List': case 'List':

View File

@ -7,7 +7,7 @@
require('./init.js'); require('./init.js');
var assert = require('assert'); var assert = require('assert');
var db, BlobModel, EnumModel, ANIMAL_ENUM, City; var db, BlobModel, EnumModel, ANIMAL_ENUM;
var mysqlVersion; var mysqlVersion;
describe('MySQL specific datatypes', function() { describe('MySQL specific datatypes', function() {
@ -86,26 +86,6 @@ describe('MySQL specific datatypes', function() {
}); });
}); });
}); });
it('should create a model instance with geopoint type', function(done) {
var city1 = {
name: 'North York',
loc: {
lat: 43.761539,
lng: -79.411079,
},
};
City.create(city1, function(err, res) {
assert.ok(!err);
res.loc.should.deepEqual(city1.loc);
res.name.should.equal(city1.name);
City.find({where: {name: city1.name}}, function(err, found) {
assert.ok(!err);
found[0].name.should.equal(city1.name);
found[0].loc.should.deepEqual(city1.loc);
done();
});
});
});
it('should disconnect when done', function(done) { it('should disconnect when done', function(done) {
db.disconnect(); db.disconnect();
done(); done();
@ -130,11 +110,6 @@ function setup(done) {
bin: {type: Buffer, dataType: 'blob', null: false}, bin: {type: Buffer, dataType: 'blob', null: false},
name: {type: String}, name: {type: String},
}); });
City = db.define('City', {
name: {type: String},
loc: {type: 'GeoPoint'},
});
query('SELECT VERSION()', function(err, res) { query('SELECT VERSION()', function(err, res) {
mysqlVersion = res && res[0] && res[0]['VERSION()']; mysqlVersion = res && res[0] && res[0]['VERSION()'];
blankDatabase(db, done); blankDatabase(db, done);