]> granicus.if.org Git - postgis/commitdiff
Add killer sed command to create a topology upgrade minor script from topology.sql...
authorRegina Obe <lr@pcorp.us>
Fri, 23 Sep 2011 22:00:16 +0000 (22:00 +0000)
committerRegina Obe <lr@pcorp.us>
Fri, 23 Sep 2011 22:00:16 +0000 (22:00 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7888 b70326c6-7e19-0410-871a-916f4a2858ee

extensions/postgis_topology/Makefile
extensions/postgis_topology/postgis_topology.control

index 81c92a8ff6da7f655ebd608400db1cd8e49d1836..9d96ea9e6a63b0d16da2f193948f0a4000f7698e 100644 (file)
@@ -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
index 7db3ebd1a244a4781d9d62835a4fd26cb3b123aa..ec021ab5675b86493bf8b10397d9a8cb5d02cc99 100644 (file)
@@ -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