1 |
4516
|
aaronmk
|
/* Prevent "cannot alter type of a column used by a view or rule" errors when
|
2 |
|
|
cleanup operations are run using in place UPDATE */
|
3 |
5694
|
aaronmk
|
DROP VIEW IF EXISTS view_all_commnames_code CASCADE;
|
4 |
|
|
DROP VIEW IF EXISTS view_all_commnames_common CASCADE;
|
5 |
|
|
DROP VIEW IF EXISTS view_all_commnames_sciname CASCADE;
|
6 |
|
|
DROP VIEW IF EXISTS view_all_commnames_translated CASCADE;
|
7 |
|
|
DROP VIEW IF EXISTS view_all_plantnames_code CASCADE;
|
8 |
|
|
DROP VIEW IF EXISTS view_all_plantnames_common CASCADE;
|
9 |
|
|
DROP VIEW IF EXISTS view_all_plantnames_sciname CASCADE;
|
10 |
|
|
DROP VIEW IF EXISTS view_all_plantnames_scinamenoauth CASCADE;
|
11 |
|
|
DROP VIEW IF EXISTS view_notemb_observation CASCADE;
|
12 |
|
|
DROP VIEW IF EXISTS view_browseparty_classcontrib CASCADE;
|
13 |
|
|
DROP VIEW IF EXISTS view_browseparty_obscontrib CASCADE;
|
14 |
|
|
DROP VIEW IF EXISTS view_browseparty_projectcontrib CASCADE;
|
15 |
|
|
DROP VIEW IF EXISTS view_browseparty_all CASCADE;
|
16 |
|
|
DROP VIEW IF EXISTS view_browseparty_all_count CASCADE;
|
17 |
|
|
DROP VIEW IF EXISTS view_browseparty_classcontrib_count CASCADE;
|
18 |
|
|
DROP VIEW IF EXISTS view_browseparty_obscontrib_count CASCADE;
|
19 |
|
|
DROP VIEW IF EXISTS view_browseparty_projectcontrib_count CASCADE;
|
20 |
|
|
DROP VIEW IF EXISTS view_browseparty_all_count_combined CASCADE;
|
21 |
|
|
DROP VIEW IF EXISTS view_busrule_duplcovercode CASCADE;
|
22 |
|
|
DROP VIEW IF EXISTS view_busrule_duplstratumtype CASCADE;
|
23 |
|
|
DROP VIEW IF EXISTS view_busrule_plotsizeshape CASCADE;
|
24 |
|
|
DROP VIEW IF EXISTS view_reference_transl CASCADE;
|
25 |
|
|
DROP VIEW IF EXISTS view_commconcept_transl CASCADE;
|
26 |
|
|
DROP VIEW IF EXISTS view_notemb_commclass CASCADE;
|
27 |
|
|
DROP VIEW IF EXISTS view_comminterp_more CASCADE;
|
28 |
|
|
DROP VIEW IF EXISTS view_csv_taxonimportance_pre CASCADE;
|
29 |
|
|
DROP VIEW IF EXISTS view_csv_taxonimportance CASCADE;
|
30 |
|
|
DROP VIEW IF EXISTS view_dbafielddesc_notimpl CASCADE;
|
31 |
|
|
DROP VIEW IF EXISTS view_emb_embargo_currentfullonly CASCADE;
|
32 |
|
|
DROP VIEW IF EXISTS view_emb_embargo_complete CASCADE;
|
33 |
|
|
DROP VIEW IF EXISTS view_keywprojplaces CASCADE;
|
34 |
|
|
DROP VIEW IF EXISTS view_kwhelper_projcontrib CASCADE;
|
35 |
|
|
DROP VIEW IF EXISTS view_kwhelper_refjournal CASCADE;
|
36 |
|
|
DROP VIEW IF EXISTS view_kwhelper_refparty CASCADE;
|
37 |
|
|
DROP VIEW IF EXISTS view_notemb_classcontributor CASCADE;
|
38 |
|
|
DROP VIEW IF EXISTS view_notemb_comminterpretation CASCADE;
|
39 |
|
|
DROP VIEW IF EXISTS view_notemb_disturbanceobs CASCADE;
|
40 |
|
|
DROP VIEW IF EXISTS view_notemb_plot CASCADE;
|
41 |
|
|
DROP VIEW IF EXISTS view_notemb_soilobs CASCADE;
|
42 |
|
|
DROP VIEW IF EXISTS view_notemb_stemcount CASCADE;
|
43 |
|
|
DROP VIEW IF EXISTS view_notemb_stemlocation CASCADE;
|
44 |
|
|
DROP VIEW IF EXISTS view_notemb_taxonalt CASCADE;
|
45 |
|
|
DROP VIEW IF EXISTS view_notemb_taxonimportance CASCADE;
|
46 |
|
|
DROP VIEW IF EXISTS view_notemb_taxoninterpretation CASCADE;
|
47 |
|
|
DROP VIEW IF EXISTS view_notemb_taxonobservation CASCADE;
|
48 |
|
|
DROP VIEW IF EXISTS view_observation_transl CASCADE;
|
49 |
|
|
DROP VIEW IF EXISTS view_party_public CASCADE;
|
50 |
|
|
DROP VIEW IF EXISTS view_party_transl CASCADE;
|
51 |
|
|
DROP VIEW IF EXISTS view_plantconcept_transl CASCADE;
|
52 |
|
|
DROP VIEW IF EXISTS view_plotall_withembargo CASCADE;
|
53 |
|
|
DROP VIEW IF EXISTS view_std_commnames_code CASCADE;
|
54 |
|
|
DROP VIEW IF EXISTS view_std_commnames_common CASCADE;
|
55 |
|
|
DROP VIEW IF EXISTS view_std_commnames_sciname CASCADE;
|
56 |
|
|
DROP VIEW IF EXISTS view_std_commnames_translated CASCADE;
|
57 |
|
|
DROP VIEW IF EXISTS view_std_plantnames_code CASCADE;
|
58 |
|
|
DROP VIEW IF EXISTS view_std_plantnames_common CASCADE;
|
59 |
|
|
DROP VIEW IF EXISTS view_std_plantnames_sciname CASCADE;
|
60 |
|
|
DROP VIEW IF EXISTS view_std_plantnames_scinamenoauth CASCADE;
|
61 |
|
|
DROP VIEW IF EXISTS view_taxoninterp_more CASCADE;
|
62 |
|
|
DROP VIEW IF EXISTS view_taxonobs_withmaxcover CASCADE;
|
63 |
|
|
DROP VIEW IF EXISTS view_taxonobs_distinctid_curr CASCADE;
|
64 |
|
|
DROP VIEW IF EXISTS view_taxonobs_distinctid_curr_counts CASCADE;
|
65 |
|
|
DROP VIEW IF EXISTS view_taxonobs_distinctid_curr_counts_plants CASCADE;
|
66 |
4525
|
aaronmk
|
|
67 |
6116
|
aaronmk
|
-- Enable cascading deletes
|
68 |
|
|
|
69 |
|
|
ALTER TABLE address DROP CONSTRAINT r1address_party_id;
|
70 |
|
|
ALTER TABLE ONLY address ADD CONSTRAINT r1address_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
71 |
|
|
|
72 |
|
|
ALTER TABLE classcontributor DROP CONSTRAINT r1classcontributor_commclass_id;
|
73 |
|
|
ALTER TABLE ONLY classcontributor ADD CONSTRAINT r1classcontributor_commclass_id FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
74 |
|
|
|
75 |
|
|
ALTER TABLE commclass DROP CONSTRAINT r1commclass_observation_id;
|
76 |
|
|
ALTER TABLE ONLY commclass ADD CONSTRAINT r1commclass_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
77 |
|
|
|
78 |
|
|
ALTER TABLE commconcept DROP CONSTRAINT r1commconcept_commname_id;
|
79 |
|
|
ALTER TABLE ONLY commconcept ADD CONSTRAINT r1commconcept_commname_id FOREIGN KEY (commname_id) REFERENCES commname(commname_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
80 |
|
|
|
81 |
|
|
ALTER TABLE commcorrelation DROP CONSTRAINT r1commcorrelation_commstatus_id;
|
82 |
|
|
ALTER TABLE ONLY commcorrelation ADD CONSTRAINT r1commcorrelation_commstatus_id FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
83 |
|
|
|
84 |
|
|
ALTER TABLE comminterpretation DROP CONSTRAINT r1comminterpretation_commclass_id;
|
85 |
|
|
ALTER TABLE ONLY comminterpretation ADD CONSTRAINT r1comminterpretation_commclass_id FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
86 |
|
|
|
87 |
|
|
ALTER TABLE commlineage DROP CONSTRAINT r1commlineage_parentcommstatus_id;
|
88 |
|
|
ALTER TABLE ONLY commlineage ADD CONSTRAINT r1commlineage_parentcommstatus_id FOREIGN KEY (parentcommstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
89 |
|
|
|
90 |
|
|
ALTER TABLE commname DROP CONSTRAINT r1commname_reference_id;
|
91 |
|
|
ALTER TABLE ONLY commname ADD CONSTRAINT r1commname_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
92 |
|
|
|
93 |
|
|
ALTER TABLE commstatus DROP CONSTRAINT r1commstatus_commconcept_id;
|
94 |
|
|
ALTER TABLE ONLY commstatus ADD CONSTRAINT r1commstatus_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
95 |
|
|
|
96 |
|
|
ALTER TABLE commusage DROP CONSTRAINT r1commusage_commname_id;
|
97 |
|
|
ALTER TABLE ONLY commusage ADD CONSTRAINT r1commusage_commname_id FOREIGN KEY (commname_id) REFERENCES commname(commname_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
98 |
|
|
|
99 |
|
|
ALTER TABLE coverindex DROP CONSTRAINT r1coverindex_covermethod_id;
|
100 |
|
|
ALTER TABLE ONLY coverindex ADD CONSTRAINT r1coverindex_covermethod_id FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
101 |
|
|
|
102 |
|
|
ALTER TABLE covermethod DROP CONSTRAINT r1covermethod_reference_id;
|
103 |
|
|
ALTER TABLE ONLY covermethod ADD CONSTRAINT r1covermethod_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
104 |
|
|
|
105 |
|
|
ALTER TABLE definedvalue DROP CONSTRAINT r1definedvalue_userdefined_id;
|
106 |
|
|
ALTER TABLE ONLY definedvalue ADD CONSTRAINT r1definedvalue_userdefined_id FOREIGN KEY (userdefined_id) REFERENCES userdefined(userdefined_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
107 |
|
|
|
108 |
|
|
ALTER TABLE disturbanceobs DROP CONSTRAINT r1disturbanceobs_observation_id;
|
109 |
|
|
ALTER TABLE ONLY disturbanceobs ADD CONSTRAINT r1disturbanceobs_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
110 |
|
|
|
111 |
|
|
ALTER TABLE embargo DROP CONSTRAINT r1embargo_plot_id;
|
112 |
|
|
ALTER TABLE ONLY embargo ADD CONSTRAINT r1embargo_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
113 |
|
|
|
114 |
|
|
ALTER TABLE graphic DROP CONSTRAINT r1graphic_observation_id;
|
115 |
|
|
ALTER TABLE ONLY graphic ADD CONSTRAINT r1graphic_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
116 |
|
|
|
117 |
|
|
ALTER TABLE namedplace DROP CONSTRAINT r1namedplace_reference_id;
|
118 |
|
|
ALTER TABLE ONLY namedplace ADD CONSTRAINT r1namedplace_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
119 |
|
|
|
120 |
|
|
ALTER TABLE namedplacecorrelation DROP CONSTRAINT r1namedplacecorrelation_parentplace_id;
|
121 |
|
|
ALTER TABLE ONLY namedplacecorrelation ADD CONSTRAINT r1namedplacecorrelation_parentplace_id FOREIGN KEY (parentplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
122 |
|
|
|
123 |
|
|
ALTER TABLE note DROP CONSTRAINT r1note_notelink_id;
|
124 |
|
|
ALTER TABLE ONLY note ADD CONSTRAINT r1note_notelink_id FOREIGN KEY (notelink_id) REFERENCES notelink(notelink_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
125 |
|
|
|
126 |
|
|
ALTER TABLE observation DROP CONSTRAINT r1observation_previousobs_id;
|
127 |
|
|
ALTER TABLE ONLY observation ADD CONSTRAINT r1observation_previousobs_id FOREIGN KEY (previousobs_id) REFERENCES observation(observation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
128 |
|
|
|
129 |
|
|
ALTER TABLE observationcontributor DROP CONSTRAINT r1observationcontributor_observation_id;
|
130 |
|
|
ALTER TABLE ONLY observationcontributor ADD CONSTRAINT r1observationcontributor_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
131 |
|
|
|
132 |
|
|
ALTER TABLE observationsynonym DROP CONSTRAINT r1observationsynonym_synonymobservation_id;
|
133 |
|
|
ALTER TABLE ONLY observationsynonym ADD CONSTRAINT r1observationsynonym_synonymobservation_id FOREIGN KEY (synonymobservation_id) REFERENCES observation(observation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
134 |
|
|
|
135 |
|
|
ALTER TABLE party DROP CONSTRAINT r1party_currentname_id;
|
136 |
|
|
ALTER TABLE ONLY party ADD CONSTRAINT r1party_currentname_id FOREIGN KEY (currentname_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
137 |
|
|
|
138 |
|
|
ALTER TABLE partymember DROP CONSTRAINT r1partymember_parentparty_id;
|
139 |
|
|
ALTER TABLE ONLY partymember ADD CONSTRAINT r1partymember_parentparty_id FOREIGN KEY (parentparty_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
140 |
|
|
|
141 |
|
|
ALTER TABLE place DROP CONSTRAINT r1place_plot_id;
|
142 |
|
|
ALTER TABLE ONLY place ADD CONSTRAINT r1place_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
143 |
|
|
|
144 |
|
|
ALTER TABLE plantconcept DROP CONSTRAINT r1plantconcept_plantname_id;
|
145 |
|
|
ALTER TABLE ONLY plantconcept ADD CONSTRAINT r1plantconcept_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
146 |
|
|
|
147 |
|
|
ALTER TABLE plantcorrelation DROP CONSTRAINT r1plantcorrelation_plantstatus_id;
|
148 |
|
|
ALTER TABLE ONLY plantcorrelation ADD CONSTRAINT r1plantcorrelation_plantstatus_id FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
149 |
|
|
|
150 |
|
|
ALTER TABLE plantlineage DROP CONSTRAINT r1plantlineage_childplantstatus_id;
|
151 |
|
|
ALTER TABLE ONLY plantlineage ADD CONSTRAINT r1plantlineage_childplantstatus_id FOREIGN KEY (childplantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
152 |
|
|
|
153 |
|
|
ALTER TABLE plantname DROP CONSTRAINT r1plantname_reference_id;
|
154 |
|
|
ALTER TABLE ONLY plantname ADD CONSTRAINT r1plantname_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
155 |
|
|
|
156 |
|
|
ALTER TABLE plantstatus DROP CONSTRAINT r1plantstatus_plantconcept_id;
|
157 |
|
|
ALTER TABLE ONLY plantstatus ADD CONSTRAINT r1plantstatus_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
158 |
|
|
|
159 |
|
|
ALTER TABLE plantusage DROP CONSTRAINT r1plantusage_plantname_id;
|
160 |
|
|
ALTER TABLE ONLY plantusage ADD CONSTRAINT r1plantusage_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
161 |
|
|
|
162 |
|
|
ALTER TABLE plot DROP CONSTRAINT r1plot_reference_id;
|
163 |
|
|
ALTER TABLE ONLY plot ADD CONSTRAINT r1plot_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
164 |
|
|
|
165 |
|
|
ALTER TABLE projectcontributor DROP CONSTRAINT r1projectcontributor_project_id;
|
166 |
|
|
ALTER TABLE ONLY projectcontributor ADD CONSTRAINT r1projectcontributor_project_id FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
167 |
|
|
|
168 |
|
|
ALTER TABLE reference DROP CONSTRAINT r1reference_referencejournal_id;
|
169 |
|
|
ALTER TABLE ONLY reference ADD CONSTRAINT r1reference_referencejournal_id FOREIGN KEY (referencejournal_id) REFERENCES referencejournal(referencejournal_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
170 |
|
|
|
171 |
|
|
ALTER TABLE referencealtident DROP CONSTRAINT r1referencealtident_reference_id;
|
172 |
|
|
ALTER TABLE ONLY referencealtident ADD CONSTRAINT r1referencealtident_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
173 |
|
|
|
174 |
|
|
ALTER TABLE referencecontributor DROP CONSTRAINT r1referencecontributor_reference_id;
|
175 |
|
|
ALTER TABLE ONLY referencecontributor ADD CONSTRAINT r1referencecontributor_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
176 |
|
|
|
177 |
|
|
ALTER TABLE referenceparty DROP CONSTRAINT r1referenceparty_currentparty_id;
|
178 |
|
|
ALTER TABLE ONLY referenceparty ADD CONSTRAINT r1referenceparty_currentparty_id FOREIGN KEY (currentparty_id) REFERENCES referenceparty(referenceparty_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
179 |
|
|
|
180 |
|
|
ALTER TABLE revision DROP CONSTRAINT r1revision_previousrevision_id;
|
181 |
|
|
ALTER TABLE ONLY revision ADD CONSTRAINT r1revision_previousrevision_id FOREIGN KEY (previousrevision_id) REFERENCES revision(revision_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
182 |
|
|
|
183 |
|
|
ALTER TABLE soilobs DROP CONSTRAINT r1soilobs_observation_id;
|
184 |
|
|
ALTER TABLE ONLY soilobs ADD CONSTRAINT r1soilobs_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
185 |
|
|
|
186 |
|
|
ALTER TABLE soiltaxon DROP CONSTRAINT r1soiltaxon_soilparent_id;
|
187 |
|
|
ALTER TABLE ONLY soiltaxon ADD CONSTRAINT r1soiltaxon_soilparent_id FOREIGN KEY (soilparent_id) REFERENCES soiltaxon(soiltaxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
188 |
|
|
|
189 |
|
|
ALTER TABLE stemcount DROP CONSTRAINT r1stemcount_taxonimportance_id;
|
190 |
|
|
ALTER TABLE ONLY stemcount ADD CONSTRAINT r1stemcount_taxonimportance_id FOREIGN KEY (taxonimportance_id) REFERENCES taxonimportance(taxonimportance_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
191 |
|
|
|
192 |
|
|
ALTER TABLE stemlocation DROP CONSTRAINT r1stemlocation_stemcount_id;
|
193 |
|
|
ALTER TABLE ONLY stemlocation ADD CONSTRAINT r1stemlocation_stemcount_id FOREIGN KEY (stemcount_id) REFERENCES stemcount(stemcount_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
194 |
|
|
|
195 |
|
|
ALTER TABLE stratum DROP CONSTRAINT r1stratum_observation_id;
|
196 |
|
|
ALTER TABLE ONLY stratum ADD CONSTRAINT r1stratum_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
197 |
|
|
|
198 |
|
|
ALTER TABLE stratummethod DROP CONSTRAINT r1stratummethod_reference_id;
|
199 |
|
|
ALTER TABLE ONLY stratummethod ADD CONSTRAINT r1stratummethod_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
200 |
|
|
|
201 |
|
|
ALTER TABLE stratumtype DROP CONSTRAINT r1stratumtype_stratummethod_id;
|
202 |
|
|
ALTER TABLE ONLY stratumtype ADD CONSTRAINT r1stratumtype_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
203 |
|
|
|
204 |
|
|
ALTER TABLE taxonalt DROP CONSTRAINT r1taxonalt_taxoninterpretation_id;
|
205 |
|
|
ALTER TABLE ONLY taxonalt ADD CONSTRAINT r1taxonalt_taxoninterpretation_id FOREIGN KEY (taxoninterpretation_id) REFERENCES taxoninterpretation(taxoninterpretation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
206 |
|
|
|
207 |
|
|
ALTER TABLE taxonimportance DROP CONSTRAINT r1taxonimportance_taxonobservation_id;
|
208 |
|
|
ALTER TABLE ONLY taxonimportance ADD CONSTRAINT r1taxonimportance_taxonobservation_id FOREIGN KEY (taxonobservation_id) REFERENCES taxonobservation(taxonobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
209 |
|
|
|
210 |
|
|
ALTER TABLE taxoninterpretation DROP CONSTRAINT r1taxoninterpretation_taxonobservation_id;
|
211 |
|
|
ALTER TABLE ONLY taxoninterpretation ADD CONSTRAINT r1taxoninterpretation_taxonobservation_id FOREIGN KEY (taxonobservation_id) REFERENCES taxonobservation(taxonobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
212 |
|
|
|
213 |
|
|
ALTER TABLE taxonobservation DROP CONSTRAINT r1taxonobservation_observation_id;
|
214 |
|
|
ALTER TABLE ONLY taxonobservation ADD CONSTRAINT r1taxonobservation_observation_id FOREIGN KEY (observation_id) REFERENCES observation(observation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
215 |
|
|
|
216 |
|
|
ALTER TABLE telephone DROP CONSTRAINT r1telephone_party_id;
|
217 |
|
|
ALTER TABLE ONLY telephone ADD CONSTRAINT r1telephone_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
218 |
|
|
|
219 |
|
|
ALTER TABLE usercertification DROP CONSTRAINT r1usercertification_usr_id;
|
220 |
|
|
ALTER TABLE ONLY usercertification ADD CONSTRAINT r1usercertification_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
221 |
|
|
|
222 |
|
|
ALTER TABLE userdataset DROP CONSTRAINT r1userdataset_usr_id;
|
223 |
|
|
ALTER TABLE ONLY userdataset ADD CONSTRAINT r1userdataset_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
224 |
|
|
|
225 |
|
|
ALTER TABLE userdatasetitem DROP CONSTRAINT r1userdatasetitem_userdataset_id;
|
226 |
|
|
ALTER TABLE ONLY userdatasetitem ADD CONSTRAINT r1userdatasetitem_userdataset_id FOREIGN KEY (userdataset_id) REFERENCES userdataset(userdataset_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
227 |
|
|
|
228 |
|
|
ALTER TABLE usernotify DROP CONSTRAINT r1usernotify_usr_id;
|
229 |
|
|
ALTER TABLE ONLY usernotify ADD CONSTRAINT r1usernotify_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
230 |
|
|
|
231 |
|
|
ALTER TABLE userpermission DROP CONSTRAINT r1userpermission_embargo_id;
|
232 |
|
|
ALTER TABLE ONLY userpermission ADD CONSTRAINT r1userpermission_embargo_id FOREIGN KEY (embargo_id) REFERENCES embargo(embargo_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
233 |
|
|
|
234 |
|
|
ALTER TABLE userpreference DROP CONSTRAINT r1userpreference_usr_id;
|
235 |
|
|
ALTER TABLE ONLY userpreference ADD CONSTRAINT r1userpreference_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
236 |
|
|
|
237 |
|
|
ALTER TABLE userquery DROP CONSTRAINT r1userquery_usr_id;
|
238 |
|
|
ALTER TABLE ONLY userquery ADD CONSTRAINT r1userquery_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
239 |
|
|
|
240 |
|
|
ALTER TABLE userrecordowner DROP CONSTRAINT r1userrecordowner_usr_id;
|
241 |
|
|
ALTER TABLE ONLY userrecordowner ADD CONSTRAINT r1userrecordowner_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
242 |
|
|
|
243 |
|
|
ALTER TABLE userregionalexp DROP CONSTRAINT r1userregionalexp_usercertification_id;
|
244 |
|
|
ALTER TABLE ONLY userregionalexp ADD CONSTRAINT r1userregionalexp_usercertification_id FOREIGN KEY (usercertification_id) REFERENCES usercertification(usercertification_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
245 |
|
|
|
246 |
|
|
ALTER TABLE usr DROP CONSTRAINT r1usr_party_id;
|
247 |
|
|
ALTER TABLE ONLY usr ADD CONSTRAINT r1usr_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
248 |
|
|
|
249 |
|
|
ALTER TABLE address DROP CONSTRAINT r2address_organization_id;
|
250 |
|
|
ALTER TABLE ONLY address ADD CONSTRAINT r2address_organization_id FOREIGN KEY (organization_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
251 |
|
|
|
252 |
|
|
ALTER TABLE classcontributor DROP CONSTRAINT r2classcontributor_party_id;
|
253 |
|
|
ALTER TABLE ONLY classcontributor ADD CONSTRAINT r2classcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
254 |
|
|
|
255 |
|
|
ALTER TABLE commclass DROP CONSTRAINT r2commclass_classpublication_id;
|
256 |
|
|
ALTER TABLE ONLY commclass ADD CONSTRAINT r2commclass_classpublication_id FOREIGN KEY (classpublication_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
257 |
|
|
|
258 |
|
|
ALTER TABLE commconcept DROP CONSTRAINT r2commconcept_reference_id;
|
259 |
|
|
ALTER TABLE ONLY commconcept ADD CONSTRAINT r2commconcept_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
260 |
|
|
|
261 |
|
|
ALTER TABLE commcorrelation DROP CONSTRAINT r2commcorrelation_commconcept_id;
|
262 |
|
|
ALTER TABLE ONLY commcorrelation ADD CONSTRAINT r2commcorrelation_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
263 |
|
|
|
264 |
|
|
ALTER TABLE comminterpretation DROP CONSTRAINT r2comminterpretation_commconcept_id;
|
265 |
|
|
ALTER TABLE ONLY comminterpretation ADD CONSTRAINT r2comminterpretation_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
266 |
|
|
|
267 |
|
|
ALTER TABLE commlineage DROP CONSTRAINT r2commlineage_childcommstatus_id;
|
268 |
|
|
ALTER TABLE ONLY commlineage ADD CONSTRAINT r2commlineage_childcommstatus_id FOREIGN KEY (childcommstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
269 |
|
|
|
270 |
|
|
ALTER TABLE commstatus DROP CONSTRAINT r2commstatus_reference_id;
|
271 |
|
|
ALTER TABLE ONLY commstatus ADD CONSTRAINT r2commstatus_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
272 |
|
|
|
273 |
|
|
ALTER TABLE commusage DROP CONSTRAINT r2commusage_commconcept_id;
|
274 |
|
|
ALTER TABLE ONLY commusage ADD CONSTRAINT r2commusage_commconcept_id FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
275 |
|
|
|
276 |
|
|
ALTER TABLE namedplacecorrelation DROP CONSTRAINT r2namedplacecorrelation_childplace_id;
|
277 |
|
|
ALTER TABLE ONLY namedplacecorrelation ADD CONSTRAINT r2namedplacecorrelation_childplace_id FOREIGN KEY (childplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
278 |
|
|
|
279 |
|
|
ALTER TABLE note DROP CONSTRAINT r2note_party_id;
|
280 |
|
|
ALTER TABLE ONLY note ADD CONSTRAINT r2note_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
281 |
|
|
|
282 |
|
|
ALTER TABLE observation DROP CONSTRAINT r2observation_plot_id;
|
283 |
|
|
ALTER TABLE ONLY observation ADD CONSTRAINT r2observation_plot_id FOREIGN KEY (plot_id) REFERENCES plot(plot_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
284 |
|
|
|
285 |
|
|
ALTER TABLE observationcontributor DROP CONSTRAINT r2observationcontributor_party_id;
|
286 |
|
|
ALTER TABLE ONLY observationcontributor ADD CONSTRAINT r2observationcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
287 |
|
|
|
288 |
|
|
ALTER TABLE observationsynonym DROP CONSTRAINT r2observationsynonym_primaryobservation_id;
|
289 |
|
|
ALTER TABLE ONLY observationsynonym ADD CONSTRAINT r2observationsynonym_primaryobservation_id FOREIGN KEY (primaryobservation_id) REFERENCES observation(observation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
290 |
|
|
|
291 |
|
|
ALTER TABLE partymember DROP CONSTRAINT r2partymember_childparty_id;
|
292 |
|
|
ALTER TABLE ONLY partymember ADD CONSTRAINT r2partymember_childparty_id FOREIGN KEY (childparty_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
293 |
|
|
|
294 |
|
|
ALTER TABLE place DROP CONSTRAINT r2place_namedplace_id;
|
295 |
|
|
ALTER TABLE ONLY place ADD CONSTRAINT r2place_namedplace_id FOREIGN KEY (namedplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
296 |
|
|
|
297 |
|
|
ALTER TABLE plantconcept DROP CONSTRAINT r2plantconcept_reference_id;
|
298 |
|
|
ALTER TABLE ONLY plantconcept ADD CONSTRAINT r2plantconcept_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
299 |
|
|
|
300 |
|
|
ALTER TABLE plantcorrelation DROP CONSTRAINT r2plantcorrelation_plantconcept_id;
|
301 |
|
|
ALTER TABLE ONLY plantcorrelation ADD CONSTRAINT r2plantcorrelation_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
302 |
|
|
|
303 |
|
|
ALTER TABLE plantlineage DROP CONSTRAINT r2plantlineage_parentplantstatus_id;
|
304 |
|
|
ALTER TABLE ONLY plantlineage ADD CONSTRAINT r2plantlineage_parentplantstatus_id FOREIGN KEY (parentplantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
305 |
|
|
|
306 |
|
|
ALTER TABLE plantstatus DROP CONSTRAINT r2plantstatus_reference_id;
|
307 |
|
|
ALTER TABLE ONLY plantstatus ADD CONSTRAINT r2plantstatus_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
308 |
|
|
|
309 |
|
|
ALTER TABLE plantusage DROP CONSTRAINT r2plantusage_plantconcept_id;
|
310 |
|
|
ALTER TABLE ONLY plantusage ADD CONSTRAINT r2plantusage_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
311 |
|
|
|
312 |
|
|
ALTER TABLE plot DROP CONSTRAINT r2plot_parent_id;
|
313 |
|
|
ALTER TABLE ONLY plot ADD CONSTRAINT r2plot_parent_id FOREIGN KEY (parent_id) REFERENCES plot(plot_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
314 |
|
|
|
315 |
|
|
ALTER TABLE projectcontributor DROP CONSTRAINT r2projectcontributor_party_id;
|
316 |
|
|
ALTER TABLE ONLY projectcontributor ADD CONSTRAINT r2projectcontributor_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
317 |
|
|
|
318 |
|
|
ALTER TABLE referencecontributor DROP CONSTRAINT r2referencecontributor_referenceparty_id;
|
319 |
|
|
ALTER TABLE ONLY referencecontributor ADD CONSTRAINT r2referencecontributor_referenceparty_id FOREIGN KEY (referenceparty_id) REFERENCES referenceparty(referenceparty_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
320 |
|
|
|
321 |
|
|
ALTER TABLE stratum DROP CONSTRAINT r2stratum_stratumtype_id;
|
322 |
|
|
ALTER TABLE ONLY stratum ADD CONSTRAINT r2stratum_stratumtype_id FOREIGN KEY (stratumtype_id) REFERENCES stratumtype(stratumtype_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
323 |
|
|
|
324 |
|
|
ALTER TABLE taxonalt DROP CONSTRAINT r2taxonalt_plantconcept_id;
|
325 |
|
|
ALTER TABLE ONLY taxonalt ADD CONSTRAINT r2taxonalt_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
326 |
|
|
|
327 |
|
|
ALTER TABLE taxonimportance DROP CONSTRAINT r2taxonimportance_stratum_id;
|
328 |
|
|
ALTER TABLE ONLY taxonimportance ADD CONSTRAINT r2taxonimportance_stratum_id FOREIGN KEY (stratum_id) REFERENCES stratum(stratum_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
329 |
|
|
|
330 |
|
|
ALTER TABLE taxoninterpretation DROP CONSTRAINT r2taxoninterpretation_stemlocation_id;
|
331 |
|
|
ALTER TABLE ONLY taxoninterpretation ADD CONSTRAINT r2taxoninterpretation_stemlocation_id FOREIGN KEY (stemlocation_id) REFERENCES stemlocation(stemlocation_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
332 |
|
|
|
333 |
|
|
ALTER TABLE taxonobservation DROP CONSTRAINT r2taxonobservation_reference_id;
|
334 |
|
|
ALTER TABLE ONLY taxonobservation ADD CONSTRAINT r2taxonobservation_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
335 |
|
|
|
336 |
|
|
ALTER TABLE userpermission DROP CONSTRAINT r2userpermission_usr_id;
|
337 |
|
|
ALTER TABLE ONLY userpermission ADD CONSTRAINT r2userpermission_usr_id FOREIGN KEY (usr_id) REFERENCES usr(usr_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
338 |
|
|
|
339 |
|
|
ALTER TABLE classcontributor DROP CONSTRAINT r3classcontributor_role_id;
|
340 |
|
|
ALTER TABLE ONLY classcontributor ADD CONSTRAINT r3classcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
341 |
|
|
|
342 |
|
|
ALTER TABLE comminterpretation DROP CONSTRAINT r3comminterpretation_commauthority_id;
|
343 |
|
|
ALTER TABLE ONLY comminterpretation ADD CONSTRAINT r3comminterpretation_commauthority_id FOREIGN KEY (commauthority_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
344 |
|
|
|
345 |
|
|
ALTER TABLE commstatus DROP CONSTRAINT r3commstatus_commparent_id;
|
346 |
|
|
ALTER TABLE ONLY commstatus ADD CONSTRAINT r3commstatus_commparent_id FOREIGN KEY (commparent_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
347 |
|
|
|
348 |
|
|
ALTER TABLE commusage DROP CONSTRAINT r3commusage_party_id;
|
349 |
|
|
ALTER TABLE ONLY commusage ADD CONSTRAINT r3commusage_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
350 |
|
|
|
351 |
|
|
ALTER TABLE note DROP CONSTRAINT r3note_role_id;
|
352 |
|
|
ALTER TABLE ONLY note ADD CONSTRAINT r3note_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
353 |
|
|
|
354 |
|
|
ALTER TABLE observation DROP CONSTRAINT r3observation_project_id;
|
355 |
|
|
ALTER TABLE ONLY observation ADD CONSTRAINT r3observation_project_id FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
356 |
|
|
|
357 |
|
|
ALTER TABLE observationcontributor DROP CONSTRAINT r3observationcontributor_role_id;
|
358 |
|
|
ALTER TABLE ONLY observationcontributor ADD CONSTRAINT r3observationcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
359 |
|
|
|
360 |
|
|
ALTER TABLE observationsynonym DROP CONSTRAINT r3observationsynonym_party_id;
|
361 |
|
|
ALTER TABLE ONLY observationsynonym ADD CONSTRAINT r3observationsynonym_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
362 |
|
|
|
363 |
|
|
ALTER TABLE partymember DROP CONSTRAINT r3partymember_role_id;
|
364 |
|
|
ALTER TABLE ONLY partymember ADD CONSTRAINT r3partymember_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
365 |
|
|
|
366 |
|
|
ALTER TABLE plantstatus DROP CONSTRAINT r3plantstatus_plantparent_id;
|
367 |
|
|
ALTER TABLE ONLY plantstatus ADD CONSTRAINT r3plantstatus_plantparent_id FOREIGN KEY (plantparent_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
368 |
|
|
|
369 |
|
|
ALTER TABLE plantusage DROP CONSTRAINT r3plantusage_party_id;
|
370 |
|
|
ALTER TABLE ONLY plantusage ADD CONSTRAINT r3plantusage_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
371 |
|
|
|
372 |
|
|
ALTER TABLE projectcontributor DROP CONSTRAINT r3projectcontributor_role_id;
|
373 |
|
|
ALTER TABLE ONLY projectcontributor ADD CONSTRAINT r3projectcontributor_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
374 |
|
|
|
375 |
|
|
ALTER TABLE stratum DROP CONSTRAINT r3stratum_stratummethod_id;
|
376 |
|
|
ALTER TABLE ONLY stratum ADD CONSTRAINT r3stratum_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
377 |
|
|
|
378 |
|
|
ALTER TABLE taxoninterpretation DROP CONSTRAINT r3taxoninterpretation_plantconcept_id;
|
379 |
|
|
ALTER TABLE ONLY taxoninterpretation ADD CONSTRAINT r3taxoninterpretation_plantconcept_id FOREIGN KEY (plantconcept_id) REFERENCES plantconcept(plantconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
380 |
|
|
|
381 |
|
|
ALTER TABLE commstatus DROP CONSTRAINT r4commstatus_party_id;
|
382 |
|
|
ALTER TABLE ONLY commstatus ADD CONSTRAINT r4commstatus_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
383 |
|
|
|
384 |
|
|
ALTER TABLE commusage DROP CONSTRAINT r4commusage_commstatus_id;
|
385 |
|
|
ALTER TABLE ONLY commusage ADD CONSTRAINT r4commusage_commstatus_id FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
386 |
|
|
|
387 |
|
|
ALTER TABLE observation DROP CONSTRAINT r4observation_covermethod_id;
|
388 |
|
|
ALTER TABLE ONLY observation ADD CONSTRAINT r4observation_covermethod_id FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
389 |
|
|
|
390 |
|
|
ALTER TABLE observationsynonym DROP CONSTRAINT r4observationsynonym_role_id;
|
391 |
|
|
ALTER TABLE ONLY observationsynonym ADD CONSTRAINT r4observationsynonym_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
392 |
|
|
|
393 |
|
|
ALTER TABLE plantstatus DROP CONSTRAINT r4plantstatus_party_id;
|
394 |
|
|
ALTER TABLE ONLY plantstatus ADD CONSTRAINT r4plantstatus_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
395 |
|
|
|
396 |
|
|
ALTER TABLE plantusage DROP CONSTRAINT r4plantusage_plantstatus_id;
|
397 |
|
|
ALTER TABLE ONLY plantusage ADD CONSTRAINT r4plantusage_plantstatus_id FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
398 |
|
|
|
399 |
|
|
ALTER TABLE taxoninterpretation DROP CONSTRAINT r4taxoninterpretation_plantname_id;
|
400 |
|
|
ALTER TABLE ONLY taxoninterpretation ADD CONSTRAINT r4taxoninterpretation_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
401 |
|
|
|
402 |
|
|
ALTER TABLE observation DROP CONSTRAINT r5observation_stratummethod_id;
|
403 |
|
|
ALTER TABLE ONLY observation ADD CONSTRAINT r5observation_stratummethod_id FOREIGN KEY (stratummethod_id) REFERENCES stratummethod(stratummethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
404 |
|
|
|
405 |
|
|
ALTER TABLE taxoninterpretation DROP CONSTRAINT r5taxoninterpretation_party_id;
|
406 |
|
|
ALTER TABLE ONLY taxoninterpretation ADD CONSTRAINT r5taxoninterpretation_party_id FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
407 |
|
|
|
408 |
|
|
ALTER TABLE observation DROP CONSTRAINT r6observation_soiltaxon_id;
|
409 |
|
|
ALTER TABLE ONLY observation ADD CONSTRAINT r6observation_soiltaxon_id FOREIGN KEY (soiltaxon_id) REFERENCES soiltaxon(soiltaxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
410 |
|
|
|
411 |
|
|
ALTER TABLE taxoninterpretation DROP CONSTRAINT r6taxoninterpretation_role_id;
|
412 |
|
|
ALTER TABLE ONLY taxoninterpretation ADD CONSTRAINT r6taxoninterpretation_role_id FOREIGN KEY (role_id) REFERENCES aux_role(role_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
413 |
|
|
|
414 |
|
|
ALTER TABLE taxoninterpretation DROP CONSTRAINT r7taxoninterpretation_reference_id;
|
415 |
|
|
ALTER TABLE ONLY taxoninterpretation ADD CONSTRAINT r7taxoninterpretation_reference_id FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
416 |
|
|
|
417 |
|
|
ALTER TABLE taxoninterpretation DROP CONSTRAINT r8taxoninterpretation_collector_id;
|
418 |
|
|
ALTER TABLE ONLY taxoninterpretation ADD CONSTRAINT r8taxoninterpretation_collector_id FOREIGN KEY (collector_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
419 |
|
|
|
420 |
|
|
ALTER TABLE taxoninterpretation DROP CONSTRAINT r9taxoninterpretation_museum_id;
|
421 |
|
|
ALTER TABLE ONLY taxoninterpretation ADD CONSTRAINT r9taxoninterpretation_museum_id FOREIGN KEY (museum_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
422 |
|
|
|
423 |
6155
|
aaronmk
|
-- Remove private data that should not be publicly visible
|
424 |
6082
|
aaronmk
|
ALTER TABLE plot DROP COLUMN reallatitude;
|
425 |
|
|
ALTER TABLE plot DROP COLUMN reallongitude;
|
426 |
|
|
|
427 |
6117
|
aaronmk
|
DELETE FROM plot WHERE plot_id IN (
|
428 |
|
|
SELECT plot_id FROM embargo WHERE embargostop > now()
|
429 |
|
|
);
|
430 |
6155
|
aaronmk
|
-- Do not delete confidentialitystatus >= 4 whose embargos have already expired
|
431 |
|
|
-- This corresponds to location/public/full embargos (http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&wparam=plot&entity=dba_tabledescription&where=where_tablename#confidentialityStatus)
|
432 |
6117
|
aaronmk
|
|
433 |
4525
|
aaronmk
|
-- Prevent "column name specified more than once" errors when tables are joined
|
434 |
4547
|
aaronmk
|
ALTER TABLE taxonobservation RENAME reference_id TO taxonobservation_reference_id;
|
435 |
4525
|
aaronmk
|
ALTER TABLE taxonobservation RENAME accessioncode TO taxonobservation_accessioncode;
|
436 |
6172
|
aaronmk
|
ALTER TABLE taxoninterpretation RENAME party_id TO taxoninterpretation_party_id;
|
437 |
4525
|
aaronmk
|
ALTER TABLE taxoninterpretation RENAME plantname_id TO taxoninterpretation_plantname_id;
|
438 |
|
|
ALTER TABLE taxoninterpretation RENAME accessioncode TO taxoninterpretation_accessioncode;
|
439 |
6173
|
aaronmk
|
ALTER TABLE party RENAME d_obscount TO party_d_obscount;
|
440 |
4535
|
aaronmk
|
ALTER TABLE plantconcept RENAME reference_id TO plantconcept_reference_id;
|
441 |
10686
|
aaronmk
|
ALTER TABLE plantconcept RENAME plantname TO plantconcept_plantname;
|
442 |
4535
|
aaronmk
|
ALTER TABLE plantconcept RENAME accessioncode TO plantconcept_accessioncode;
|
443 |
10686
|
aaronmk
|
ALTER TABLE plantname RENAME reference_id TO plantname_reference_id;
|