Changes between Version 36 and Version 37 of InstallationGuidelines/Linux/Server/CherokeePostgreSQL
- Timestamp:
- 03/14/12 16:22:05 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
InstallationGuidelines/Linux/Server/CherokeePostgreSQL
v36 v37 629 629 sed -i 's|deployment_settings.database.db_type = "sqlite"|deployment_settings.database.db_type = "postgres"|' ~web2py/applications/eden/models/000_config.py 630 630 sed -i "s|deployment_settings.database.password = \"password\"|deployment_settings.database.password = \"$password\"|" ~web2py/applications/eden/models/000_config.py 631 sed -i 's|deployment_settings.gis.spatialdb = False|deployment_settings.gis.spatialdb = True|' ~web2py/applications/eden/models/000_config.py 631 # Spatial DAL not yet in Trunk Web2Py 632 #sed -i 's|deployment_settings.gis.spatialdb = False|deployment_settings.gis.spatialdb = True|' ~web2py/applications/eden/models/000_config.py 632 633 633 634 # Create the Tables & Populate with base data … … 637 638 sudo -H -u web2py python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py 638 639 639 # PostGIS the Sahana DB640 cat << EOF > "/tmp/geometry.sql"641 UPDATE public.gis_location SET wkt = 'POINT (' || lon || ' ' || lat || ')' WHERE gis_feature_type = 1;642 SELECT AddGeometryColumn( 'public', 'gis_location', 'the_geom', 4326, 'GEOMETRY', 2 );643 GRANT ALL ON geometry_columns TO sahana;644 UPDATE public.gis_location SET the_geom = ST_SetSRID(ST_GeomFromText(wkt), 4326);645 EOF646 su -c - postgres "psql -q -d sahana -f /tmp/geometry.sql"647 cat << EOF > "/tmp/autopopulate.sql"648 CREATE OR REPLACE FUNCTION s3_update_geometry()649 RETURNS "trigger" AS \$$650 DECLARE651 BEGIN652 if (NEW.wkt != '') then653 NEW.the_geom = SetSRID(GeomFromText(NEW.wkt), 4326);654 end if;655 656 RETURN NEW;657 END;658 \$$ LANGUAGE 'plpgsql' VOLATILE;659 ALTER FUNCTION s3_update_geometry() OWNER TO sahana;660 CREATE TRIGGER s3_locations_update661 BEFORE INSERT662 ON gis_location663 FOR EACH ROW664 EXECUTE PROCEDURE s3_update_geometry();665 666 EOF667 su -c - postgres "psql -q -d sahana -f /tmp/autopopulate.sql"668 669 640 # Configure for Production 670 641 sed -i 's|deployment_settings.base.prepopulate = 1|deployment_settings.base.prepopulate = 0|' ~web2py/applications/eden/models/000_config.py