[Mapbender-commits] r8402 - trunk/mapbender/resources/db/pgsql/UTF-8/update

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jul 2 06:30:08 PDT 2012


Author: tbaschetti
Date: 2012-07-02 06:30:08 -0700 (Mon, 02 Jul 2012)
New Revision: 8402

Modified:
   trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.6.2_to_2.7rc1_pgsql_UTF-8.sql
   trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7rc1_to_2.7rc2_pgsql_UTF-8.sql
Log:
added "IF EXISTS" to DROP TABLE/VIEW/FUNCTION 
to prevent error-messages during install



Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.6.2_to_2.7rc1_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.6.2_to_2.7rc1_pgsql_UTF-8.sql	2012-07-02 13:25:15 UTC (rev 8401)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.6.2_to_2.7rc1_pgsql_UTF-8.sql	2012-07-02 13:30:08 UTC (rev 8402)
@@ -593,8 +593,8 @@
 
 --*****wmc adoptions****
 
-DROP TABLE wmc_keyword CASCADE;
-DROP TABLE wmc_md_topic_category CASCADE;
+DROP TABLE IF EXISTS wmc_keyword CASCADE;
+DROP TABLE IF EXISTS wmc_md_topic_category CASCADE;
 
 
 --adopt mb_user_wmc to store a serial column too!
@@ -2197,10 +2197,10 @@
   LANGUAGE 'plpgsql' VOLATILE;
 --MetadataViews
 
-DROP VIEW search_wms_view;
+DROP VIEW IF EXISTS search_wms_view;
 
 CREATE OR REPLACE VIEW search_wms_view AS 
- SELECT DISTINCT ON (wms_unref.layer_id) wms_unref.wms_id, wms_unref.availability, wms_unref.status, wms_unref.wms_title, wms_unref.wms_abstract, wms_unref.stateorprovince, wms_unref.country, wms_unref.accessconstraints, wms_unref.termsofuse, wms_unref.wms_owner, wms_unref.layer_id, wms_unref.epsg, wms_unref.layer_title, wms_unref.layer_abstract, wms_unref.layer_name, wms_unref.layer_parent, wms_unref.layer_pos, wms_unref.layer_queryable, wms_unref.load_count, wms_unref.searchtext, wms_unref.wms_timestamp, wms_unref.department, wms_unref.mb_group_name, f_collect_custom_cat_layer(wms_unref.layer_id) AS md_custom_cats, f_collect_inspire_cat_layer(wms_unref.layer_id) AS md_inspire_cats, f_collect_topic_cat_layer(wms_unref.layer_id) AS md_topic_cats, geometryfromtext(((((((((((((((((((('POLYGON(('::text || layer_epsg.minx::text) || ' '::text) || layer_epsg.miny::text) || ','::text) || layer_epsg.minx::text) || ' '::text) || layer_epsg.maxy::text) || ','::text) || layer_epsg.maxx
 ::text) || ' '::text) || layer_epsg.maxy::text) || ','::text) || layer_epsg.maxx::text) || ' '::text) || layer_epsg.miny::text) || ','::text) || layer_epsg.minx::text) || ' '::text) || layer_epsg.miny::text) || '))'::text, 4326) AS the_geom, (((((layer_epsg.minx::text || ','::text) || layer_epsg.miny::text) || ','::text) || layer_epsg.maxx::text) || ','::text) || layer_epsg.maxy::text AS bbox, wms_unref.wms_proxylog, wms_unref.wms_network_access, wms_unref.wms_pricevolume, wms_unref.mb_group_logo_path
+ SELECT DISTINCT ON (wms_unref.layer_id) wms_unref.wms_id, wms_unref.availability, wms_unref.status, wms_unref.wms_title, wms_unref.wms_abstract, wms_unref.stateorprovince, wms_unref.country, wms_unref.accessconstraints, wms_unref.termsofuse, wms_unref.wms_owner, wms_unref.layer_id, wms_unref.epsg, wms_unref.layer_title, wms_unref.layer_abstract, wms_unref.layer_name, wms_unref.layer_parent, wms_unref.layer_pos, wms_unref.layer_queryable, wms_unref.load_count, wms_unref.searchtext, wms_unref.wms_timestamp, wms_unref.department, wms_unref.mb_group_name, f_collect_custom_cat_layer(wms_unref.layer_id) AS md_custom_cats, f_collect_inspire_cat_layer(wms_unref.layer_id) AS md_inspire_cats, f_collect_topic_cat_layer(wms_unref.layer_id) AS md_topic_cats, st_geometryfromtext(((((((((((((((((((('POLYGON(('::text || layer_epsg.minx::text) || ' '::text) || layer_epsg.miny::text) || ','::text) || layer_epsg.minx::text) || ' '::text) || layer_epsg.maxy::text) || ','::text) || layer_epsg.m
 axx::text) || ' '::text) || layer_epsg.maxy::text) || ','::text) || layer_epsg.maxx::text) || ' '::text) || layer_epsg.miny::text) || ','::text) || layer_epsg.minx::text) || ' '::text) || layer_epsg.miny::text) || '))'::text, 4326) AS the_geom, (((((layer_epsg.minx::text || ','::text) || layer_epsg.miny::text) || ','::text) || layer_epsg.maxx::text) || ','::text) || layer_epsg.maxy::text AS bbox, wms_unref.wms_proxylog, wms_unref.wms_network_access, wms_unref.wms_pricevolume, wms_unref.mb_group_logo_path
    FROM ( SELECT wms_uncat.wms_id, wms_uncat.availability, wms_uncat.status, wms_uncat.wms_title, wms_uncat.wms_abstract, wms_uncat.stateorprovince, wms_uncat.country, wms_uncat.accessconstraints, wms_uncat.termsofuse, wms_uncat.wms_owner, wms_uncat.layer_id, wms_uncat.epsg, wms_uncat.layer_title, wms_uncat.layer_abstract, wms_uncat.layer_name, wms_uncat.layer_parent, wms_uncat.layer_pos, wms_uncat.layer_queryable, wms_uncat.load_count, wms_uncat.searchtext, wms_uncat.wms_timestamp, wms_uncat.department, wms_uncat.mb_group_name, wms_uncat.wms_proxylog, wms_uncat.wms_network_access, wms_uncat.wms_pricevolume, wms_uncat.mb_group_logo_path
            FROM ( SELECT wms_dep.wms_id, wms_dep.availability, wms_dep.status, wms_dep.wms_title, wms_dep.wms_abstract, wms_dep.stateorprovince, wms_dep.country, wms_dep.accessconstraints, wms_dep.termsofuse, wms_dep.wms_owner, layer.layer_id, f_collect_epsg(layer.layer_id) AS epsg, layer.layer_title, layer.layer_abstract, layer.layer_name, layer.layer_parent, layer.layer_pos, layer.layer_queryable, f_layer_load_count(layer.layer_id) AS load_count, f_collect_searchtext(wms_dep.wms_id, layer.layer_id) AS searchtext, wms_dep.wms_timestamp, wms_dep.department, wms_dep.mb_group_name, wms_dep.wms_proxylog, wms_dep.wms_network_access, wms_dep.wms_pricevolume, wms_dep.mb_group_logo_path
                    FROM ( SELECT wms.wms_id, wms.wms_title, wms.wms_abstract, wms.stateorprovince, wms.country, mb_wms_availability.availability, mb_wms_availability.last_status AS status, wms.accessconstraints, f_getwms_tou(wms.wms_id) AS termsofuse, wms.wms_timestamp, wms.wms_owner, wms.wms_proxylog, wms.wms_network_access, wms.wms_pricevolume, user_dep.fkey_mb_group_id AS department, user_dep.fkey_mb_group_id, user_dep.fkey_mb_group_id AS wms_department, user_dep.mb_group_name,  user_dep.mb_group_logo_path
@@ -2212,7 +2212,7 @@
   WHERE layer_epsg.epsg::text = 'EPSG:4326'::text AND wms_unref.layer_id = layer_epsg.fkey_layer_id
   ORDER BY wms_unref.layer_id;
 
-DROP VIEW search_wfs_view;
+DROP VIEW IF EXISTS search_wfs_view;
 -- View: search_wfs_view
 CREATE OR REPLACE VIEW search_wfs_view AS 
  SELECT wfs_dep.wfs_id, wfs_dep.wfs_title, wfs_dep.wfs_abstract, wfs_dep.administrativearea, wfs_dep.country, wfs_dep.accessconstraints, wfs_dep.termsofuse, wfs_dep.wfs_owner, wfs_featuretype.featuretype_id, wfs_featuretype.featuretype_srs, wfs_featuretype.featuretype_title, wfs_featuretype.featuretype_abstract, f_collect_searchtext_wfs(wfs_dep.wfs_id, wfs_featuretype.featuretype_id) AS searchtext, wfs_element.element_type, wfs_conf.wfs_conf_id, wfs_conf.wfs_conf_abstract, wfs_conf.wfs_conf_description, f_getwfsmodultype(wfs_conf.wfs_conf_id) AS modultype, wfs_dep.wfs_timestamp, wfs_dep.department, wfs_dep.mb_group_name, wfs_dep.mb_group_logo_path
@@ -2319,8 +2319,8 @@
 
 
 --****wmc-begin****
-DROP FUNCTION f_collect_searchtext_wmc(character varying) CASCADE;
-DROP FUNCTION  f_collect_topic_cat_wmc(character varying) CASCADE;
+DROP FUNCTION IF EXISTS f_collect_searchtext_wmc(character varying) CASCADE;
+DROP FUNCTION IF EXISTS f_collect_topic_cat_wmc(character varying) CASCADE;
 
 -- Function: f_collect_searchtext_wmc(integer)
 
@@ -2392,17 +2392,18 @@
 
 --new categories for publishing -> custom , inspire ?
 -- Table: wmc_custom_category
-CREATE TABLE wmc_custom_category
-(
-  fkey_wmc_serial_id integer NOT NULL,
-  fkey_custom_category_id integer NOT NULL,
-  CONSTRAINT wmc_custom_category_fkey_wmc_serial_id_fkey FOREIGN KEY (fkey_wmc_serial_id)
-      REFERENCES mb_user_wmc (wmc_serial_id) MATCH SIMPLE
-      ON UPDATE CASCADE ON DELETE CASCADE,
-  CONSTRAINT wmc_custom_category_fkey_custom_category_id_fkey FOREIGN KEY (fkey_custom_category_id)
-      REFERENCES custom_category (custom_category_id) MATCH SIMPLE
-      ON UPDATE CASCADE ON DELETE CASCADE
-);
+-- allready done above
+-- CREATE TABLE wmc_custom_category
+-- (
+  -- fkey_wmc_serial_id integer NOT NULL,
+  -- fkey_custom_category_id integer NOT NULL,
+  -- CONSTRAINT wmc_custom_category_fkey_wmc_serial_id_fkey FOREIGN KEY (fkey_wmc_serial_id)
+      -- REFERENCES mb_user_wmc (wmc_serial_id) MATCH SIMPLE
+      -- ON UPDATE CASCADE ON DELETE CASCADE,
+  -- CONSTRAINT wmc_custom_category_fkey_custom_category_id_fkey FOREIGN KEY (fkey_custom_category_id)
+      -- REFERENCES custom_category (custom_category_id) MATCH SIMPLE
+      -- ON UPDATE CASCADE ON DELETE CASCADE
+-- );
 
 -- Table: wmc_inspire_category
 CREATE TABLE wmc_inspire_category
@@ -2485,13 +2486,8 @@
 
 -- View: search_wmc_view
 
--- DROP VIEW search_wmc_view;
+DROP VIEW IF EXISTS search_wmc_view;
 --TODO: get group information out of mb_group table instead of ows information, cause in this case there can be more than one different service in a resource 
-
--- View: search_wmc_view
-
-DROP VIEW search_wmc_view;
---TODO: get group information out of mb_group table instead of ows information, cause in this case there can be more than one different service in a resource 
 --TODO: set public flag to some wmc docs to generate usefull results
 --TODO: get infos from old wmc docs into table structure (abstract, coords, ...)
 -- View: search_wmc_view
@@ -2499,7 +2495,7 @@
 -- DROP VIEW search_wmc_view;
 
 CREATE OR REPLACE VIEW search_wmc_view AS 
- SELECT wmc_dep.fkey_user_id AS user_id, wmc_dep.wmc_id, wmc_dep.srs AS wmc_srs, wmc_dep.wmc_title, wmc_dep.abstract AS wmc_abstract, f_collect_searchtext_wmc(wmc_dep.wmc_id) AS searchtext, wmc_dep.wmc_timestamp, wmc_dep.department, wmc_dep.mb_group_name, wmc_dep.mb_group_title, wmc_dep.mb_group_country, wmc_dep.wmc_serial_id, wmc_dep.mb_group_stateorprovince, f_collect_inspire_cat_wmc(wmc_dep.wmc_serial_id) AS md_inspire_cats, f_collect_custom_cat_wmc(wmc_dep.wmc_serial_id) AS md_custom_cats, f_collect_topic_cat_wmc(wmc_dep.wmc_id) AS md_topic_cats, transform(geometryfromtext(((((((((((((((((((('POLYGON(('::text || wmc_dep.minx::text) || ' '::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.minx::text) || ' '::text) || wmc_dep.maxy::text) || ','::text) || wmc_dep.maxx::text) || ' '::text) || wmc_dep.maxy::text) || ','::text) || wmc_dep.maxx::text) || ' '::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.minx::text) || ' '::text) || wmc_dep.miny::text) || '))'::tex
 t, regexp_replace(upper(wmc_dep.srs::text), 'EPSG:'::text, ''::text)::integer), 4326) AS the_geom, (((((wmc_dep.minx::text || ','::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.maxx::text) || ','::text) || wmc_dep.maxy::text AS bbox, wmc_dep.mb_group_logo_path
+ SELECT wmc_dep.fkey_user_id AS user_id, wmc_dep.wmc_id, wmc_dep.srs AS wmc_srs, wmc_dep.wmc_title, wmc_dep.abstract AS wmc_abstract, f_collect_searchtext_wmc(wmc_dep.wmc_id) AS searchtext, wmc_dep.wmc_timestamp, wmc_dep.department, wmc_dep.mb_group_name, wmc_dep.mb_group_title, wmc_dep.mb_group_country, wmc_dep.wmc_serial_id, wmc_dep.mb_group_stateorprovince, f_collect_inspire_cat_wmc(wmc_dep.wmc_serial_id) AS md_inspire_cats, f_collect_custom_cat_wmc(wmc_dep.wmc_serial_id) AS md_custom_cats, f_collect_topic_cat_wmc(wmc_dep.wmc_id) AS md_topic_cats, st_transform(st_geometryfromtext(((((((((((((((((((('POLYGON(('::text || wmc_dep.minx::text) || ' '::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.minx::text) || ' '::text) || wmc_dep.maxy::text) || ','::text) || wmc_dep.maxx::text) || ' '::text) || wmc_dep.maxy::text) || ','::text) || wmc_dep.maxx::text) || ' '::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.minx::text) || ' '::text) || wmc_dep.miny::text) || '))
 '::text, regexp_replace(upper(wmc_dep.srs::text), 'EPSG:'::text, ''::text)::integer), 4326) AS the_geom, (((((wmc_dep.minx::text || ','::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.maxx::text) || ','::text) || wmc_dep.maxy::text AS bbox, wmc_dep.mb_group_logo_path
    FROM ( SELECT mb_user_wmc.wmc_public, mb_user_wmc.maxy, mb_user_wmc.maxx, mb_user_wmc.miny, mb_user_wmc.minx, mb_user_wmc.srs, mb_user_wmc.wmc_serial_id AS wmc_id, mb_user_wmc.wmc_serial_id, mb_user_wmc.wmc_title, mb_user_wmc.abstract, mb_user_wmc.wmc_timestamp, mb_user_wmc.fkey_user_id, user_dep.mb_group_id AS department, user_dep.mb_group_name, user_dep.mb_group_title, user_dep.mb_group_country, user_dep.mb_group_stateorprovince, user_dep.mb_group_logo_path
            FROM ( SELECT registrating_groups.fkey_mb_user_id AS mb_user_id, mb_group.mb_group_id, mb_group.mb_group_name, mb_group.mb_group_title, mb_group.mb_group_country, mb_group.mb_group_stateorprovince, mb_group.mb_group_logo_path
                    FROM registrating_groups, mb_group

Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7rc1_to_2.7rc2_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7rc1_to_2.7rc2_pgsql_UTF-8.sql	2012-07-02 13:25:15 UTC (rev 8401)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7rc1_to_2.7rc2_pgsql_UTF-8.sql	2012-07-02 13:30:08 UTC (rev 8402)
@@ -30,10 +30,10 @@
 --
 -- View: search_wmc_view
 
-DROP VIEW search_wmc_view;
+DROP VIEW IF EXISTS search_wmc_view;
 
 CREATE OR REPLACE VIEW search_wmc_view AS 
- SELECT wmc_dep.fkey_user_id AS user_id, wmc_dep.wmc_id, wmc_dep.srs AS wmc_srs, wmc_dep.wmc_title, wmc_dep.abstract AS wmc_abstract, f_collect_searchtext_wmc(wmc_dep.wmc_id) AS searchtext, wmc_dep.wmc_timestamp, wmc_dep.department, wmc_dep.mb_group_name, wmc_dep.mb_group_title, wmc_dep.mb_group_country, wmc_dep.wmc_serial_id, f_wmc_load_count(wmc_dep.wmc_serial_id) as load_count, wmc_dep.mb_group_stateorprovince, f_collect_inspire_cat_wmc(wmc_dep.wmc_serial_id) AS md_inspire_cats, f_collect_custom_cat_wmc(wmc_dep.wmc_serial_id) AS md_custom_cats, f_collect_topic_cat_wmc(wmc_dep.wmc_id) AS md_topic_cats, transform(geometryfromtext(((((((((((((((((((('POLYGON(('::text || wmc_dep.minx::text) || ' '::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.minx::text) || ' '::text) || wmc_dep.maxy::text) || ','::text) || wmc_dep.maxx::text) || ' '::text) || wmc_dep.maxy::text) || ','::text) || wmc_dep.maxx::text) || ' '::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.minx::
 text) || ' '::text) || wmc_dep.miny::text) || '))'::text, regexp_replace(upper(wmc_dep.srs::text), 'EPSG:'::text, ''::text)::integer), 4326) AS the_geom, (((((wmc_dep.minx::text || ','::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.maxx::text) || ','::text) || wmc_dep.maxy::text AS bbox, wmc_dep.mb_group_logo_path
+ SELECT wmc_dep.fkey_user_id AS user_id, wmc_dep.wmc_id, wmc_dep.srs AS wmc_srs, wmc_dep.wmc_title, wmc_dep.abstract AS wmc_abstract, f_collect_searchtext_wmc(wmc_dep.wmc_id) AS searchtext, wmc_dep.wmc_timestamp, wmc_dep.department, wmc_dep.mb_group_name, wmc_dep.mb_group_title, wmc_dep.mb_group_country, wmc_dep.wmc_serial_id, f_wmc_load_count(wmc_dep.wmc_serial_id) as load_count, wmc_dep.mb_group_stateorprovince, f_collect_inspire_cat_wmc(wmc_dep.wmc_serial_id) AS md_inspire_cats, f_collect_custom_cat_wmc(wmc_dep.wmc_serial_id) AS md_custom_cats, f_collect_topic_cat_wmc(wmc_dep.wmc_id) AS md_topic_cats, st_transform(st_geometryfromtext(((((((((((((((((((('POLYGON(('::text || wmc_dep.minx::text) || ' '::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.minx::text) || ' '::text) || wmc_dep.maxy::text) || ','::text) || wmc_dep.maxx::text) || ' '::text) || wmc_dep.maxy::text) || ','::text) || wmc_dep.maxx::text) || ' '::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.
 minx::text) || ' '::text) || wmc_dep.miny::text) || '))'::text, regexp_replace(upper(wmc_dep.srs::text), 'EPSG:'::text, ''::text)::integer), 4326) AS the_geom, (((((wmc_dep.minx::text || ','::text) || wmc_dep.miny::text) || ','::text) || wmc_dep.maxx::text) || ','::text) || wmc_dep.maxy::text AS bbox, wmc_dep.mb_group_logo_path
    FROM ( SELECT mb_user_wmc.wmc_public, mb_user_wmc.maxy, mb_user_wmc.maxx, mb_user_wmc.miny, mb_user_wmc.minx, mb_user_wmc.srs, mb_user_wmc.wmc_serial_id AS wmc_id, mb_user_wmc.wmc_serial_id, mb_user_wmc.wmc_title, mb_user_wmc.abstract, mb_user_wmc.wmc_timestamp, mb_user_wmc.fkey_user_id, user_dep.mb_group_id AS department, user_dep.mb_group_name, user_dep.mb_group_title, user_dep.mb_group_country, user_dep.mb_group_stateorprovince, user_dep.mb_group_logo_path
            FROM ( SELECT registrating_groups.fkey_mb_user_id AS mb_user_id, mb_group.mb_group_id, mb_group.mb_group_name, mb_group.mb_group_title, mb_group.mb_group_country, mb_group.mb_group_stateorprovince, mb_group.mb_group_logo_path
                    FROM registrating_groups, mb_group
@@ -124,10 +124,10 @@
 ALTER TABLE wfs ADD COLUMN uuid UUID;
 ALTER TABLE wfs_featuretype ADD COLUMN uuid UUID;
 
-ALTER TABLE wms ADD COLUMN uuid character varying;
-ALTER TABLE layer ADD COLUMN uuid character varying;
-ALTER TABLE wfs ADD COLUMN uuid character varying;
-ALTER TABLE wfs_featuretype ADD COLUMN uuid character varying;
+-- ALTER TABLE wms ADD COLUMN uuid character varying;
+-- ALTER TABLE layer ADD COLUMN uuid character varying;
+-- ALTER TABLE wfs ADD COLUMN uuid character varying;
+-- ALTER TABLE wfs_featuretype ADD COLUMN uuid character varying;
 
 
 -- enlarge the size of the featureinfo dialog window



More information about the Mapbender_commits mailing list