From: Regina Obe Date: Fri, 23 Sep 2011 22:00:16 +0000 (+0000) Subject: Add killer sed command to create a topology upgrade minor script from topology.sql... X-Git-Tag: 2.0.0alpha1~966 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d48d8489468b60b3ebdef5053ca1b30d7a14eebf;p=postgis Add killer sed command to create a topology upgrade minor script from topology.sql. Also change release version to 2.0.0a1 since we haven't released yet. This will build a script to upgrade our mislabeled 2.0.0 to 2.0.0a1 git-svn-id: http://svn.osgeo.org/postgis/trunk@7888 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/extensions/postgis_topology/Makefile b/extensions/postgis_topology/Makefile index 81c92a8ff..9d96ea9e6 100644 --- a/extensions/postgis_topology/Makefile +++ b/extensions/postgis_topology/Makefile @@ -7,11 +7,11 @@ PG_CONFIG = pg_config PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" && echo no || echo yes) SQL_BITS = $(wildcard sql_bits/*.sql) -EXTRA_CLEAN += sql/$(EXTENSION).sql ${SQL_BITS} +EXTRA_CLEAN += sql/*.sql ${SQL_BITS} ifeq ($(PG91),yes) -all: sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql +all: sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql sql/$(EXTENSION)--2.0.0--$(EXTVERSION).sql sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql cp $< $@ @@ -40,6 +40,22 @@ sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: ../../topology/topology.sql -e 's/(;/;/' \ -e 's/\\(;/;/' \ -e 's/;;/;/g' $< > $@ + +#upgrade script should have everything but table, schema, type creation/alter +#first expression deletes all non-removable objects defined on same line +#second deletes all non-removable defined on multiple lines +#aggregates are special +#they can be dropped but we need to remove +#them from the extension first +sql/topology_upgrade_minor.sql: sql_bits/topology.sql + sed -e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\).*;/d' \ + -e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\)/,/\;/d' \ + -e 's/^DROP AGGREGATE IF EXISTS\(.*\);/ALTER EXTENSION $(EXTENSION) DROP AGGREGATE \1;DROP AGGREGATE \1;/' \ + $< > $@ + +sql/$(EXTENSION)--2.0.0--$(EXTVERSION).sql: sql/topology_upgrade_minor.sql + cp $< $@ + DATA = $(wildcard sql/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql EXTRA_CLEAN += sql/$(EXTENSION)--$(EXTVERSION).sql sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql endif diff --git a/extensions/postgis_topology/postgis_topology.control b/extensions/postgis_topology/postgis_topology.control index 7db3ebd1a..ec021ab56 100644 --- a/extensions/postgis_topology/postgis_topology.control +++ b/extensions/postgis_topology/postgis_topology.control @@ -1,6 +1,6 @@ # postgis topology extension comment = 'postgis topology spatial types and functions' -default_version = '2.0.0' +default_version = '2.0.0a1' relocatable = false schema = topology requires = postgis_core