Skip to content

Instantly share code, notes, and snippets.

@t-book
Last active December 2, 2019 15:02
Show Gist options
  • Save t-book/14bc849ad9567ca28a24c122d52ff77d to your computer and use it in GitHub Desktop.
Save t-book/14bc849ad9567ca28a24c122d52ff77d to your computer and use it in GitHub Desktop.
#!/bin/bash
sudo -u postgres psql -d geonode -c "UPDATE base_resourcebase SET thumbnail_url = replace(thumbnail_url, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE maps_maplayer SET ows_url = replace(ows_url, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE maps_maplayer SET layer_params = replace(layer_params, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE maps_maplayer SET source_params = replace(source_params, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE maps_mapsnapshot SET config = replace(config, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE base_resourcebase SET supplemental_information = replace(supplemental_information, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE base_resourcebase SET csw_anytext = replace(csw_anytext, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE django_site SET domain = replace(domain, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE layers_style SET sld_url = replace(sld_url, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE base_resourcebase SET metadata_xml = replace(metadata_xml, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE base_link SET url = replace(url, '$1', '$2')"
@t-book
Copy link
Author

t-book commented Dec 2, 2019

@fra_fra nice, thanks. To dump the data and just use sed worked for me as well in several instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment