Project

General

Profile

« Previous | Next » 

Revision 5693

input.Makefile: Staging tables installation: %/install: Fixed bug where a .src table's row_num column needed to have the table name prefixed (making it globally unique) to allow joining the table with other tables

View differences:

input.Makefile
164 164

  
165 165
##### Staging tables installation
166 166

  
167
srcTable := %.src
168

  
167 169
dbExports := $(sort $(wildcard *.schema.sql))# schemas first
168 170
dbExports += $(sort $(filter-out $(dbExports),$(wildcard *.sql)))# all others
169 171
dbExports := $(strip $(dbExports))# += adds extra whitespace
......
230 232

  
231 233
%/install: _always
232 234
	$(if $(isRef),$(exportHeader),$(if $(nonXml),$(import_install_)))
233
import_install_ = (prefix=; . $(bin)/vegbien_dest; "time" nice -n +5\
235
define import_install_
236
(prefix=; . $(bin)/vegbien_dest; "time" nice -n +5\
234 237
env schema=$(datasrc) table=$* $(bin)/csv2db $(catSrcs) $(logInstall*))
238
# table-scope src table's row_num col to allow joining it with other tables
239
$(if $(filter $(srcTable),$*),($(inDatasrc);\
240
echo 'ALTER TABLE "$(datasrc)"."$*" RENAME row_num TO "$*.row_num";')|"time"\
241
$(psqlAsBien) --echo-all --set=table='"$*"' $(logInstall*Add))
242
endef
235 243

  
236 244
cleanup: _always $(tables:%=%/cleanup) ;
237 245

  

Also available in: Unified diff