You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our incidents database, there are a number of incidents with the city field set to New York. There is no corresponding geoname for this city. The one in the geonames.geonames table is New York City. We want to update the geoname to match our use of the city name.
In my opinion, this is best done by running this query:
UPDATE geonames_geoname SET name ='New York'WHERE name ='New York City';
In the Django shell, this is:
fromgeonames.modelsimportGeoNameGeoName.objects.filter(name="New York City").update(name="New York")
To fix the incidents currently in production:
Run the above query/shell commands.
Either:
Run the ./manage.py populate_geodata command. This will update all incidents to have their lat/long data reflect the updated geonames DB, including the ones with the city "New York"
Refresh the incident lat/long data one-by-one loading the ones you want to fix in the wagtail editor and issuing a "Publish" command.
Additionally, we will want to apply this change everywhere we can, so we should update the fixtures to use the correct name.
The easiest way to do this is to:
Ensure that the fixtures have been loaded in the local dev environment (docker compose exec django ./manage.py loaddata --app geonames cities500-us-only.json.xz)
Update the DB using the query or shell commands from above.
In our incidents database, there are a number of incidents with the
city
field set toNew York
. There is no corresponding geoname for this city. The one in thegeonames.geonames
table isNew York City
. We want to update the geoname to match our use of the city name.In my opinion, this is best done by running this query:
In the Django shell, this is:
To fix the incidents currently in production:
./manage.py populate_geodata
command. This will update all incidents to have their lat/long data reflect the updated geonames DB, including the ones with the city "New York"Additionally, we will want to apply this change everywhere we can, so we should update the fixtures to use the correct name.
The easiest way to do this is to:
docker compose exec django ./manage.py loaddata --app geonames cities500-us-only.json.xz
)docker compose exec django ./manage.py dumpdata geonames -o geonames/fixtures/cities500-us-only.json.xz
The text was updated successfully, but these errors were encountered: