-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from DPIclimate/postgis_and_db_v2
Convert device table location columns to PostGIS geometry datatype
- Loading branch information
Showing
9 changed files
with
216 additions
and
215 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
CREATE EXTENSION postgis; | ||
CREATE EXTENSION pgcrypto; | ||
|
||
SELECT AddGeometryColumn('logical_devices','geom',4283,'POINT',2); | ||
SELECT AddGeometryColumn('physical_devices','geom',4283,'POINT',2); | ||
|
||
UPDATE logical_devices SET geom = ST_MakePoint(location[1], location[0]) WHERE location IS NOT NULL; | ||
UPDATE physical_devices SET geom = ST_MakePoint(location[1], location[0]) WHERE location IS NOT NULL; | ||
|
||
ALTER TABLE logical_devices DROP COLUMN location; | ||
ALTER TABLE physical_devices DROP COLUMN location; | ||
|
||
ALTER TABLE logical_devices RENAME COLUMN geom TO location; | ||
ALTER TABLE physical_devices RENAME COLUMN geom TO location; | ||
|
||
TRUNCATE version; | ||
insert into version values (2); |
Oops, something went wrong.