Skip to content
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

Upgrade script database 0.5 -> 0.6 #5

Open
bertt opened this issue Mar 22, 2018 · 3 comments
Open

Upgrade script database 0.5 -> 0.6 #5

bertt opened this issue Mar 22, 2018 · 3 comments

Comments

@bertt
Copy link
Contributor

bertt commented Mar 22, 2018

Create update script database from 0.5 to 0.6 for existing databases

@justb4
Copy link

justb4 commented Apr 13, 2018

Question: I am upgrading our GOST DB to work with latest GOST server (Docker). Have applied this script:
https://github.com/Geonovum/smartemission/blob/master/database/upgrades/upgrade3.sql
seems ok, but have the geojson columns for existing records be filled explicitly?

@justb4
Copy link

justb4 commented Apr 13, 2018

Ok, appears that only new records have the geojson field populated:

image

So the upgrade script needs to be extended IMO. Typical JSON structure is

{"type": "Point", "coordinates": [5.671321, 51.472583]}

justb4 added a commit to smartemission/smartemission that referenced this issue Apr 17, 2018
justb4 added a commit to smartemission/smartemission that referenced this issue Apr 17, 2018
@justb4
Copy link

justb4 commented Apr 17, 2018

I successfully applied this upgrade script:
https://github.com/Geonovum/smartemission/blob/master/database/upgrades/upgrade3.sql, the essence is to fill the geojson column like:

UPDATE v1.location SET geojson = concat('{"type": "Point", "coordinates": [' || ST_X(location) || ', ' ||  ST_Y(location) || ']}')::jsonb;

Possibly there is a cleaner way using the new json PG-functions but this worked on PG-PostGIS 9.4-2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants