1
|
/* 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
|
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
|
|
67
|
-- Remove private columns that should not be publicly visible
|
68
|
ALTER TABLE plot DROP COLUMN reallatitude;
|
69
|
ALTER TABLE plot DROP COLUMN reallongitude;
|
70
|
|
71
|
-- Prevent "column name specified more than once" errors when tables are joined
|
72
|
ALTER TABLE taxonobservation RENAME reference_id TO taxonobservation_reference_id;
|
73
|
ALTER TABLE taxonobservation RENAME accessioncode TO taxonobservation_accessioncode;
|
74
|
ALTER TABLE taxoninterpretation RENAME plantname_id TO taxoninterpretation_plantname_id;
|
75
|
ALTER TABLE taxoninterpretation RENAME accessioncode TO taxoninterpretation_accessioncode;
|
76
|
ALTER TABLE plantconcept RENAME reference_id TO plantconcept_reference_id;
|
77
|
ALTER TABLE plantconcept RENAME accessioncode TO plantconcept_accessioncode;
|