]> granicus.if.org Git - postgis/commitdiff
dupe 2934 (give Northwest next id), get rid of hard-coding of schemas in sh line
authorRegina Obe <lr@pcorp.us>
Thu, 8 Aug 2013 23:11:53 +0000 (23:11 +0000)
committerRegina Obe <lr@pcorp.us>
Thu, 8 Aug 2013 23:11:53 +0000 (23:11 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11753 b70326c6-7e19-0410-871a-916f4a2858ee

extras/tiger_geocoder/tiger_2011/tiger_loader_2012.sql

index 051cf3b560bf9d8429a86f59beff6a5fe4ccae5c..9f9e8b2e62b054e9bb67ab67432dbf2e43f56e62 100644 (file)
@@ -76,8 +76,9 @@ set PSQL="%PGBIN%psql"
 set SHP2PGSQL="%PGBIN%shp2pgsql"
 cd ${staging_fold}
 ', E'del %TMPDIR%\\*.* /Q
-%PSQL% -c "DROP SCHEMA ${staging_schema} CASCADE;"
-%PSQL% -c "CREATE SCHEMA ${staging_schema};"
+%PSQL% -c "DROP SCHEMA IF EXISTS ${staging_schema} CASCADE;"
+%PSQL% -c "CREATE SCHEMA IF NOT EXISTS ${staging_schema};"
+%PSQL% -c "CREATE SCHEMA IF NOT EXISTS ${data_schema};"
 for /r %%z in (*.zip) do %UNZIPTOOL% e %%z  -o%TMPDIR% 
 cd %TMPDIR%', E'%PSQL%', E'\\', E'%SHP2PGSQL%', 'set ', 
 'for /r %%z in (*${table_name}.dbf) do (${loader}  -s 4269 -g the_geom -W "latin1" %%z tiger_staging.${state_abbrev}_${table_name} | ${psql} & ${psql} -c "SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''));")'
@@ -99,8 +100,9 @@ PSQL=${PGBIN}/psql
 SHP2PGSQL=${PGBIN}/shp2pgsql
 cd ${staging_fold}
 ', E'rm -f ${TMPDIR}/*.*
-${PSQL} -c "DROP SCHEMA tiger_staging CASCADE;"
-${PSQL} -c "CREATE SCHEMA tiger_staging;"
+${PSQL} -c "DROP SCHEMA IF EXISTS ${staging_schema} CASCADE;"
+${PSQL} -c "CREATE SCHEMA IF NOT EXISTS ${staging_schema};"
+${PSQL} -c "CREATE SCHEMA IF NOT EXISTS ${data_schema};"
 
 for z in *.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
 for z in */*.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done