Project

General

Profile

« Previous | Next » 

Revision 3404

backups/Makefile: Factored backup command into $(backup) for later use by full DB backups. Made Backups, Archived imports sections subsections of Archived imports so Full DB backups can have its own section.

View differences:

Makefile
21 21
# DB
22 22
psqlVerbose := $(bin)/psql_script_vegbien --echo-all
23 23
pg_dump := $(bin)/pg_dump_vegbien
24
backup := "time" env data=1 $(pg_dump)
25
restore := "time" $(bin)/postgres_vegbien pg_restore --exit-on-error
26
restoreBien := $(restore) --dbname=vegbien
27
# pg_restore doesn't support PGDATABASE env var
24 28
rmSchema = 'DROP SCHEMA IF EXISTS "$(1)" CASCADE;'
25 29

  
26 30
##### General targets
......
34 38
_always:
35 39
.PHONY: _always
36 40

  
37
##### Backups
41
##### Archived imports
38 42

  
39
restore := "time" $(bin)/postgres_vegbien pg_restore --exit-on-error
40
restoreBien := $(restore) --dbname=vegbien
41
# pg_restore doesn't support PGDATABASE env var
43
#### Backups
42 44

  
43 45
# Must come before %.sql with no prerequisites to be matched first
44 46
%.sql: %
......
48 50
# pg_dump doesn't back up the CREATE SCHEMA statement for it, assuming falsely
49 51
# that public already exists because it's in template1.
50 52
%.backup %.sql:
51
	"time" env data=1 $(if $(filter %.sql,$@),plain=1) $(pg_dump) $* >$@
53
	$(if $(filter %.sql,$@),env plain=1) $(backup) $* >$@
52 54

  
53 55
%.backup/restore: %.backup _always
54 56
	$(restoreBien) $<
......
58 60
# pg_restore only supports "non-plain-text formats"
59 61
# (http://www.postgresql.org/docs/9.1/static/app-pgrestore.html)
60 62

  
61
##### Archived imports
63
#### Maintenance
62 64

  
63 65
confirmRm = $(call confirm,WARNING: This will delete the archived import $(1)!)
64 66

  

Also available in: Unified diff