Project

General

Profile

« Previous | Next » 

Revision 4425

input.Makefile: Staging tables installation: DB exports: Concatenate all exports together, with schemas first, so that any config options which were applied only in the schema export will remain active when the data is imported. Changed `%.pg.sql: .my.sql` to `.schema.sql: %.schema.my.sql` so there doesn't need to be a .pg suffix for PostgreSQL schemas and only the schema gets translated.

View differences:

input.Makefile
168 168

  
169 169
##### Staging tables installation
170 170

  
171
dbExports := $(filter-out %.my.sql,$(wildcard *.sql))
172
allInstalls := $(dbExports) $(allTables)
171
dbExports := $(wildcard *.schema.sql)# schemas first
172
dbExports += $(filter-out $(dbExports) %.my.sql,$(wildcard *.sql))# all others
173
allInstalls := $(if $(dbExports),sql) $(allTables)
173 174

  
174 175
install: _always schema $(allInstalls:%=%/install) ;
175 176

  
......
186 187
	echo 'DROP SCHEMA IF EXISTS "$(datasrc)" CASCADE;'|$(psqlAsBien)
187 188

  
188 189
# Must come before %/install to override it
189
%.sql/install: %.sql _always
190
	($(inDatasrc); grep -vF 'SET search_path' $<)|"time" $(psqlAsBien)
190
sql/install: $(dbExports) _always
191
	($(inDatasrc); cat $+|grep -vF 'SET search_path')|"time" $(psqlAsBien)
191 192

  
192 193
# The export must be created with:
193 194
# `--compatible=postgresql --add-locks=false --set-charset`
194
%.pg.sql: %.my.sql
195
%.schema.sql: %.schema.my.sql
195 196
	$(bin)/my2pg <$< >$@
196 197

  
197 198
# For staging tables which are derived by joining together other staging tables.

Also available in: Unified diff