Project

General

Profile

« Previous | Next » 

Revision 11793

bugfix: schemas/Makefile: $(confirmRmPublicSchema): only prompt to delete the schema if it actually exists. this avoids prompting to remove a non-existent schema at the beginning of bin/import_all, which requires user attention. since bin/import_all is often run with a delayed start (e.g. to wait for a staging table reinstall to complete), the user may not be at the terminal when this message is displayed, and without this fix, the import would be prevented from running until they return.

View differences:

schemas/Makefile
29 29

  
30 30
psqlAsAdminVegbien := $(psqlAsAdmin) vegbien
31 31
psqlNoSearchPath := env no_search_path=1 ../bin/psql_script_vegbien
32
psql_verbose := env no_search_path=1 ../bin/psql_verbose_vegbien
32 33

  
33 34
# Must come before `%/install: vegbien.sql` to override it
34 35
%/install: %.sql _always
......
41 42

  
42 43
#### public
43 44

  
44
confirmRmPublicSchema = $(call confirm,WARNING: This will delete any $(1)\
45
schema of your VegBIEN DB!,$(2))
45
schema_exists = $(shell $(psql_verbose) <<<'CREATE TEMP TABLE "$(1)".t ();'\
46
2>&1|grep -F 'cannot create temporary relation in non-temporary schema')
46 47

  
48
confirmRmPublicSchema = $(if $(schema_exists),$(call\
49
confirm,WARNING: This will delete the $(1) schema of your VegBIEN DB!,$(2)))
50

  
47 51
# Installs a version of the public schema
48 52
%/install: vegbien.sql _always
49 53
	echo $(call mkSchemaCmd,$*)\

Also available in: Unified diff