Revision 13154
Added by Aaron Marcuse-Kubitza over 10 years ago
Makefile | ||
---|---|---|
10 | 10 |
|
11 | 11 |
##### General targets |
12 | 12 |
|
13 |
all = vegbien.sql vegbien.my.sql util.sql py_util.sql |
|
13 |
all = public_.sql vegbien.sql vegbien.my.sql util.sql py_util.sql
|
|
14 | 14 |
|
15 | 15 |
all: _always $(all) ; |
16 | 16 |
|
... | ... | |
31 | 31 |
psqlNoSearchPath := env no_search_path=1 ../bin/psql_script_vegbien |
32 | 32 |
psql_verbose := env no_search_path=1 ../bin/psql_verbose_vegbien |
33 | 33 |
|
34 |
# Must come before `%/install: vegbien.sql` to override it
|
|
34 |
# Must come before `%/install: public_.sql` to override it
|
|
35 | 35 |
%/install: %.sql _always |
36 | 36 |
-<$< $(psqlNoSearchPath) |
37 | 37 |
# ignore errors if schema exists |
... | ... | |
53 | 53 |
# Installs a version of the public schema |
54 | 54 |
# usage: make schemas/public/reinstall |
55 | 55 |
# make schemas/r#/reinstall |
56 |
%/install: vegbien.sql _always
|
|
56 |
%/install: public_.sql _always
|
|
57 | 57 |
echo $(call mkSchemaCmd,$*)\ |
58 | 58 |
"COMMENT ON SCHEMA \"$*\" IS 'Version: $* ($(date))';"|$(psqlNoSearchPath) |
59 | 59 |
# create a custom *_validation schema for *each* public schema, rather than |
... | ... | |
64 | 64 |
's/( |::)public(_[[:alnum:]_]+)?([.,;]| [^[:lower:]])/\1$(*q)$*\2$(*q)\3/g'\ |
65 | 65 |
|$(psqlNoSearchPath) # [[:alnum:]_]+, not ...*, because public_ is a username |
66 | 66 |
|
67 |
%/uninstall: vegbien.sql _always
|
|
67 |
%/uninstall: public_.sql _always
|
|
68 | 68 |
$(call confirmRmPublicSchema,$*) |
69 | 69 |
# don't use public.rm(), because when the public schema is incompletely |
70 | 70 |
# imported, this function will not yet exist |
... | ... | |
102 | 102 |
|
103 | 103 |
pg_dump = env schema= ../bin/pg_dump_vegbien $(1) >$@ |
104 | 104 |
|
105 |
vegbien.sql:
|
|
105 |
public_.sql:
|
|
106 | 106 |
# include schemas that depend on `public` so they are restored along with it |
107 | 107 |
unset version dump_opts; $(call pg_dump,public --schema='public_*') |
108 | 108 |
|
109 |
vegbien.sql: public_.sql |
|
110 |
(cat public_.sql; schema=1 ../bin/pg_dump_vegbien all --schema='geoscrub' \ |
|
111 |
--schema='"TNRS"' --exclude-table='*."~"*' --exclude-table='*."Source"') >$@ |
|
112 |
# `all`: prevents auto-adding a --schema entry |
|
113 |
|
|
109 | 114 |
py_util.sql: |
110 | 115 |
env owners=1 $(call pg_dump,py_util) |
111 | 116 |
|
Also available in: Unified diff
schemas/Makefile: vegbien.sql: also include geoscrub, TNRS schemas, as requested in the 2014-04-10 conference call (wiki.vegpath.org/2014-04-10_conference_call#VegBIEN-schema). this involves having a separate public_.sql file for restoring the public schema.