-- PostGIS - Spatial Types for PostgreSQL
-- http://postgis.net
--
-- Copyright (C) 2012 Regina Obe <lr@pcorp.us>
-- This is free software; you can redistribute and/or modify it under
-- the terms of the GNU General Public Licence. See the COPYING file.
--
--
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-- These are functions where the argument names may have changed  --
-- so have to be dropped before upgrade can happen for 9.0+ --
-- argument names changed --
-- we might want to take toTopoGeom one out before release since
-- I don't think too many people installed the bad name
SELECT _postgis_drop_function_by_signature('topology.toTopoGeom(Geometry, varchar, int, float8)');

-- used to be in public, will now be moved to topology
SELECT _postgis_drop_function_by_signature('public.postgis_topology_scripts_installed()');

-- Removed in 2.2.0 when topology API moved to liblwgeom
SELECT _postgis_drop_function_by_signature('topology._ST_RemEdgeCheck(varchar, integer, integer, integer, integer)', '2.2.0');
-- Removed in 2.2.0 when topology API moved to liblwgeom
SELECT _postgis_drop_function_by_signature('topology._ST_AddFaceSplit(varchar, integer, integer, boolean)', '2.2.0');

-- Added optional bbox parameter in 3.2.0
SELECT _postgis_drop_function_by_signature('topology.validatetopology(varchar)', '3.2.0');

-- Merged the two function into one with both allowEdgeSplitting and setContainingFace parameters
-- being optional (3.2.0)
SELECT _postgis_drop_function_by_signature('topology.AddNode(varchar, geometry)', '3.2.0');
SELECT _postgis_drop_function_by_signature('topology.AddNode(varchar, geometry, boolean, boolean)', '3.2.0');

-- 3.6.0
-- Merged both and made child_id (integer) optional
SELECT _postgis_drop_function_by_signature('AddTopoGeometryColumn(varchar, varchar, varchar, varchar, varchar)', '3.6.0');
SELECT _postgis_drop_function_by_signature('AddTopoGeometryColumn(varchar, varchar, varchar, varchar, varchar, integer)', '3.6.0');
-- Merged all 4 functions and added optional topology_id and useslargeids
SELECT _postgis_drop_function_by_signature('topology.CreateTopology(varchar, integer, float8, boolean)', '3.6.0');
SELECT _postgis_drop_function_by_signature('topology.CreateTopology(varchar, integer, float8)', '3.6.0');
SELECT _postgis_drop_function_by_signature('topology.CreateTopology(varchar, integer)', '3.6.0');
SELECT _postgis_drop_function_by_signature('topology.CreateTopology(varchar)', '3.6.0');
-- Upgrade casts, domains, and types from integer to bigint
SELECT _postgis_drop_cast_by_types('topogeometry', 'integer[]', '3.6.0');
SELECT _postgis_topology_upgrade_domain_type('topoelement','integer[]','bigint[]','3.6.0');
SELECT _postgis_topology_upgrade_domain_type('topoelementarray','integer[][]','bigint[][]','3.6.0');
SELECT _postgis_add_column_to_table('topology.topology', 'useslargeids', 'BOOLEAN', true, 'false','3.6.0');

