Project

General

Profile

« Previous | Next » 

Revision 223

Added auto-generated vegbien_empty.sql to empty the vegbien db

View differences:

mappings/schemas/vegbien_empty.sql
1
TRUNCATE address CASCADE;
2
TRUNCATE aux_role CASCADE;
3
TRUNCATE classcontributor CASCADE;
4
TRUNCATE commclass CASCADE;
5
TRUNCATE commconcept CASCADE;
6
TRUNCATE commcorrelation CASCADE;
7
TRUNCATE comminterpretation CASCADE;
8
TRUNCATE commlineage CASCADE;
9
TRUNCATE commname CASCADE;
10
TRUNCATE commstatus CASCADE;
11
TRUNCATE commusage CASCADE;
12
TRUNCATE coverindex CASCADE;
13
TRUNCATE covermethod CASCADE;
14
TRUNCATE dba_confidentialitystatus CASCADE;
15
TRUNCATE dba_cookie CASCADE;
16
TRUNCATE dba_cookielabels CASCADE;
17
TRUNCATE dba_datacache CASCADE;
18
TRUNCATE dba_datamodelversion CASCADE;
19
TRUNCATE dba_dbstatstime CASCADE;
20
TRUNCATE dba_fielddescription CASCADE;
21
TRUNCATE dba_fieldlist CASCADE;
22
TRUNCATE dba_onerow CASCADE;
23
TRUNCATE dba_preassignacccode CASCADE;
24
TRUNCATE dba_tabledescription CASCADE;
25
TRUNCATE dba_xmlcache CASCADE;
26
TRUNCATE definedvalue CASCADE;
27
TRUNCATE disturbanceobs CASCADE;
28
TRUNCATE embargo CASCADE;
29
TRUNCATE graphic CASCADE;
30
TRUNCATE keywords CASCADE;
31
TRUNCATE keywords_extra CASCADE;
32
TRUNCATE namedplace CASCADE;
33
TRUNCATE namedplacecorrelation CASCADE;
34
TRUNCATE note CASCADE;
35
TRUNCATE notelink CASCADE;
36
TRUNCATE plotevent CASCADE;
37
TRUNCATE observationcontributor CASCADE;
38
TRUNCATE observationsynonym CASCADE;
39
TRUNCATE party CASCADE;
40
TRUNCATE partymember CASCADE;
41
TRUNCATE place CASCADE;
42
TRUNCATE plantconcept CASCADE;
43
TRUNCATE plantcorrelation CASCADE;
44
TRUNCATE plantlineage CASCADE;
45
TRUNCATE plantname CASCADE;
46
TRUNCATE plantstatus CASCADE;
47
TRUNCATE plantusage CASCADE;
48
TRUNCATE plot CASCADE;
49
TRUNCATE project CASCADE;
50
TRUNCATE projectcontributor CASCADE;
51
TRUNCATE reference CASCADE;
52
TRUNCATE referencealtident CASCADE;
53
TRUNCATE referencecontributor CASCADE;
54
TRUNCATE referencejournal CASCADE;
55
TRUNCATE referenceparty CASCADE;
56
TRUNCATE revision CASCADE;
57
TRUNCATE soilobs CASCADE;
58
TRUNCATE soiltaxon CASCADE;
59
TRUNCATE stemcount CASCADE;
60
TRUNCATE individual CASCADE;
61
TRUNCATE taxonbin CASCADE;
62
TRUNCATE stratummethod CASCADE;
63
TRUNCATE stratumtype CASCADE;
64
TRUNCATE taxonalt CASCADE;
65
TRUNCATE collectiveobs CASCADE;
66
TRUNCATE taxondetermination CASCADE;
67
TRUNCATE taxonoccurrence CASCADE;
68
TRUNCATE telephone CASCADE;
69
TRUNCATE temptbl_std_commnames CASCADE;
70
TRUNCATE temptbl_std_plantnames CASCADE;
71
TRUNCATE usercertification CASCADE;
72
TRUNCATE userdataset CASCADE;
73
TRUNCATE userdatasetitem CASCADE;
74
TRUNCATE userdefined CASCADE;
75
TRUNCATE usernotify CASCADE;
76
TRUNCATE userpermission CASCADE;
77
TRUNCATE userpreference CASCADE;
78
TRUNCATE userquery CASCADE;
79
TRUNCATE userrecordowner CASCADE;
80
TRUNCATE userregionalexp CASCADE;
81
TRUNCATE usr CASCADE;
mappings/Makefile
1
all: FORCE VegBank-VegBIEN
1
misc = schemas/vegbien.sql schemas/vegbien_empty.sql VegX-VegBIEN.organisms.csv
2

  
3
all: FORCE $(misc)
2 4
	$(MAKE) plots
3 5
	./join VegX VegBank
4 6
	./join VegX VegBIEN
5 7
	./review
8
.PRECIOUS: $(misc)
6 9

  
10
.SUFFIXES:
11

  
7 12
FORCE:
13
.PHONY: FORCE
8 14

  
9 15
all =\
10 16
$(wildcard for_review/*.csv) \
11 17
$(filter-out VegX-% VegBank-%,$(wildcard *-VegBank.*.csv)) \
12
VegX-*.plots.csv VegX-VegBIEN.organisms.csv schemas/vegbien.sql
18
VegX-*.plots.csv $(misc)
13 19

  
14 20
clean: FORCE
15 21
	$(RM) $(all)
16 22

  
23
repl = ../scripts/util/repl
17 24
sort = ../scripts/util/sort 1 0
18
repl = ../scripts/util/repl
19 25
chRoot = ../scripts/util/ch_root <$< >$@
26
empty = sed -nE 's/^CREATE TABLE ([0-9A-Za-z_]+) \($$/TRUNCATE \1 CASCADE;/p' \
27
<$< >$@
20 28

  
21 29

  
22
VegBank-VegBIEN: schemas/vegbien.sql VegX-VegBIEN.organisms.csv
23

  
24 30
schemas/vegbien.sql: schemas/vegbank.sql
25 31
	$(repl) <$< VegBank-VegBIEN.schema.csv|$(repl) VegBank-VegBIEN.csv >$@
26 32

  
33
schemas/vegbien_empty.sql: schemas/vegbien.sql
34
	$(empty)
35

  
27 36
VegX-VegBIEN.organisms.csv: VegX-VegBank.organisms.csv
28 37
	$(repl) <$< VegBank-VegBIEN.csv 1|$(sort) >$@
29 38

  
30 39

  
31
plots: $(subst .organisms.,.plots.,$(wildcard VegX-*.organisms.csv))
40
plots: FORCE $(subst .organisms.,.plots.,$(wildcard VegX-*.organisms.csv))
32 41

  
33 42
chRoot2PlotsLeftVegx =\
34 43
	env \

Also available in: Unified diff