Revision 6916
Added by Aaron Marcuse-Kubitza about 12 years ago
Makefile | ||
---|---|---|
214 | 214 |
psqlAsAdmin := $(asAdmin) psql $(psqlOpts) |
215 | 215 |
# -E preserves env vars so PGOPTIONS is passed to psql |
216 | 216 |
psqlAsAdminVegbien := $(psqlAsAdmin) vegbien |
217 |
psqlNoSearchPath := env no_search_path=1 bin/psql_script_vegbien |
|
218 | 217 |
bienPassword := $(shell cat config/bien_password) |
219 | 218 |
bienReadPassword := $(shell cat config/bien_read_password) |
220 | 219 |
|
... | ... | |
257 | 256 |
|
258 | 257 |
reinstall_db: _always rm_db db ; |
259 | 258 |
|
260 |
#### Schemas |
|
261 |
|
|
262 |
schemas := temp functions py_functions public |
|
263 |
schemas/install: $(schemas:%=schemas/%/install) ; |
|
264 |
|
|
265 |
schemasReversed := public py_functions functions temp |
|
266 |
schemas/uninstall: $(schemasReversed:%=schemas/%/uninstall) ; |
|
267 |
|
|
268 |
### public |
|
269 |
|
|
270 |
schemas/public/install: schemas/vegbien.sql _always |
|
271 |
-echo $(call mkSchemaCmd,public)|$(psqlNoSearchPath) |
|
272 |
<$< $(psqlNoSearchPath) |
|
273 |
# ignore errors if schema exists |
|
274 |
# public schema will be owned by bien |
|
275 |
# don't include public in the search_path |
|
276 |
|
|
277 |
schemas/public/uninstall: _always |
|
278 |
@$(confirmRmPublicSchema) |
|
279 |
echo $(rmPublicSchema)|$(psqlNoSearchPath) |
|
280 |
|
|
281 |
schemas/rename/%: _always |
|
282 |
echo 'ALTER SCHEMA public RENAME TO "$*";'|$(psqlNoSearchPath) |
|
283 |
$(MAKE) schemas/public/install |
|
284 |
|
|
285 |
schemas/rotate: _always schemas/rename/public.$(version) ; |
|
286 |
|
|
287 |
### py_functions |
|
288 |
|
|
289 |
schemas/py_functions/install: schemas/py_functions.sql _always |
|
290 |
-<$< env public= $(psqlAsAdminVegbien) |
|
291 |
# ignore errors if schema exists |
|
292 |
|
|
293 |
### Others |
|
294 |
|
|
295 |
schemas/%/install: schemas/%.sql _always |
|
296 |
-<$< $(psqlNoSearchPath) |
|
297 |
# ignore errors if schema exists |
|
298 |
|
|
299 |
schemas/%/uninstall: _always |
|
300 |
echo $(call rmSchemaCmd,$*)|$(psqlNoSearchPath) |
|
301 |
|
|
302 |
# Needed on Ubuntu 12.04 (also other Linuxes?) because %/reinstall is ignored. |
|
303 |
schemas/temp/reinstall: _always schemas/temp/uninstall schemas/temp/install ; |
|
304 |
|
|
305 | 259 |
##### MySQL |
306 | 260 |
|
307 | 261 |
mysql: _always $(call forOs,mysql) mysql_user |
Also available in: Unified diff
Moved schemas-related commands from root Makefile to schemas/Makefile