Repository navigation
Adding GEOMETRY Support #4013
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
Merged
Merged
Adding GEOMETRY Support #4013
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,8 @@ if (dialect.match(/^postgres/)) { | |
| course_period: DataTypes.RANGE(DataTypes.DATE), | ||
| acceptable_marks: { type: DataTypes.RANGE(DataTypes.DECIMAL), defaultValue: [0.65, 1] }, | ||
| available_amount: DataTypes.RANGE, | ||
| holidays: DataTypes.ARRAY(DataTypes.RANGE(DataTypes.DATE)) | ||
| holidays: DataTypes.ARRAY(DataTypes.RANGE(DataTypes.DATE)), | ||
| location: DataTypes.GEOMETRY() | ||
| }); | ||
| return this.User.sync({ force: true }); | ||
| }); | ||
|
|
@@ -875,6 +876,35 @@ if (dialect.match(/^postgres/)) { | |
| }); | ||
| }); | ||
|
|
||
| it('should save geometry correctly', function() { | ||
| var point = { type: 'Point', coordinates: [39.807222,-76.984722] }; | ||
| return this.User.create({ username: 'user', email: ['[email protected]'], location: point}).then(function(newUser) { | ||
| expect(newUser.location).to.deep.eql(point); | ||
| }); | ||
| }); | ||
|
|
||
| it('should update geometry correctly', function() { | ||
| var User = this.User; | ||
| var point1 = { type: 'Point', coordinates: [39.807222,-76.984722] } | ||
| , point2 = { type: 'Point', coordinates: [39.828333,-77.232222] }; | ||
| return User.create({ username: 'user', email: ['[email protected]'], location: point1}).then(function(oldUser) { | ||
| return User.update({ location: point2 }, { where: { username: oldUser.username }, returning: true }).spread(function(count, updatedUsers) { | ||
| expect(updatedUsers[0].location).to.deep.eql(point2); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| it('should read geometry correctly', function() { | ||
| var User = this.User; | ||
| var point = { type: 'Point', coordinates: [39.807222,-76.984722] }; | ||
|
|
||
| return User.create({ username: 'user', email: ['[email protected]'], location: point}).then(function(user) { | ||
| return User.find({ where: { username: user.username }}); | ||
| }).then(function(user) { | ||
| expect(user.location).to.deep.eql(point); | ||
| }); | ||
| }); | ||
|
|
||
| describe('[POSTGRES] Unquoted identifiers', function() { | ||
| it('can insert and select', function() { | ||
| var self = this; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @mikeringrose, I think you are either missing another term in this statement, or need to remove the leading "+". I tried creating geometry with DataTypes.GEOMETRY("Point", 4326) and ended up having bad queries generated due to this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the heads up. I'll be submitting a fix for this issue tomorrow
to address the following bug -
#4054. If you need things to
work for now, you can leave off the SRID. Thanks again.
Mike Ringrose
On Tue, Jul 7, 2015 at 9:22 PM, Kris Rasmussen [email protected]
wrote: