1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.cdm.database.update.v35_36;
|
12
|
|
13
|
import java.util.ArrayList;
|
14
|
import java.util.List;
|
15
|
|
16
|
import org.apache.log4j.Logger;
|
17
|
|
18
|
import eu.etaxonomy.cdm.database.update.ColumnAdder;
|
19
|
import eu.etaxonomy.cdm.database.update.ISchemaUpdater;
|
20
|
import eu.etaxonomy.cdm.database.update.ISchemaUpdaterStep;
|
21
|
import eu.etaxonomy.cdm.database.update.MnTableRemover;
|
22
|
import eu.etaxonomy.cdm.database.update.SchemaUpdaterBase;
|
23
|
import eu.etaxonomy.cdm.database.update.TableCreator;
|
24
|
import eu.etaxonomy.cdm.database.update.UniqueIndexDropper;
|
25
|
import eu.etaxonomy.cdm.database.update.v34_35.SchemaUpdater_341_35;
|
26
|
|
27
|
/**
|
28
|
* @author a.mueller
|
29
|
* @created Mar 01, 2015
|
30
|
*/
|
31
|
public class SchemaUpdater_35_36 extends SchemaUpdaterBase {
|
32
|
|
33
|
@SuppressWarnings("unused")
|
34
|
private static final Logger logger = Logger.getLogger(SchemaUpdater_35_36.class);
|
35
|
private static final String startSchemaVersion = "3.5.0.0.201531030000";
|
36
|
private static final String endSchemaVersion = "3.6.0.0.201527040000";
|
37
|
|
38
|
// ********************** FACTORY METHOD *************************************
|
39
|
|
40
|
public static SchemaUpdater_35_36 NewInstance() {
|
41
|
return new SchemaUpdater_35_36();
|
42
|
}
|
43
|
|
44
|
/**
|
45
|
* @param startSchemaVersion
|
46
|
* @param endSchemaVersion
|
47
|
*/
|
48
|
protected SchemaUpdater_35_36() {
|
49
|
super(startSchemaVersion, endSchemaVersion);
|
50
|
}
|
51
|
|
52
|
@Override
|
53
|
protected List<ISchemaUpdaterStep> getUpdaterList() {
|
54
|
|
55
|
String stepName;
|
56
|
String tableName;
|
57
|
ISchemaUpdaterStep step;
|
58
|
// String columnName;
|
59
|
String newColumnName;
|
60
|
String oldColumnName;
|
61
|
String query;
|
62
|
String columnNames[];
|
63
|
String referencedTables[];
|
64
|
String columnTypes[];
|
65
|
// boolean includeCdmBaseAttributes = false;
|
66
|
|
67
|
List<ISchemaUpdaterStep> stepList = new ArrayList<ISchemaUpdaterStep>();
|
68
|
|
69
|
//add hasMoreMembers
|
70
|
stepName = "Add hasMoreMembers to Team";
|
71
|
tableName = "AgentBase";
|
72
|
newColumnName = "hasMoreMembers";
|
73
|
step = ColumnAdder.NewBooleanInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, false);
|
74
|
stepList.add(step);
|
75
|
|
76
|
//#4843 TODO test
|
77
|
//Allow NULL for DefinedTermBase_SupportedCategoricalEnumeration
|
78
|
//.supportedcategoricalenumerations_id
|
79
|
stepName = "Remove NOT NULL from supportedcategoricalenumerations_id";
|
80
|
tableName = "DefinedTermBase_SupportedCategoricalEnumeration";
|
81
|
oldColumnName = "supportedcategoricalenumerations_id";
|
82
|
step = UniqueIndexDropper.NewInstance(tableName, oldColumnName, !INCLUDE_AUDIT);
|
83
|
stepList.add(step);
|
84
|
|
85
|
//#4843 TODO test
|
86
|
//Allow NULL for DefinedTermBase_RecommendedModifierEnumeration
|
87
|
//.recommendedmodifierenumeration_id
|
88
|
stepName = "Remove NOT NULL from recommendedmodifierenumeration_id";
|
89
|
tableName = "DefinedTermBase_RecommendedModifierEnumeration";
|
90
|
oldColumnName = "recommendedmodifierenumeration_id";
|
91
|
step = UniqueIndexDropper.NewInstance(tableName, oldColumnName, ! INCLUDE_AUDIT);
|
92
|
stepList.add(step);
|
93
|
|
94
|
//SingleReadAlignment firstSeqPosition
|
95
|
stepName = "Add firstSeqPosition";
|
96
|
tableName = "SingleReadAlignment";
|
97
|
newColumnName = "firstSeqPosition";
|
98
|
Integer defaultValue = null;
|
99
|
boolean notNull = false;
|
100
|
step = ColumnAdder.NewIntegerInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, defaultValue, notNull);
|
101
|
stepList.add(step);
|
102
|
|
103
|
//SingleReadAlignment leftCutPosition
|
104
|
stepName = "Add leftCutPosition";
|
105
|
tableName = "SingleReadAlignment";
|
106
|
newColumnName = "leftCutPosition";
|
107
|
step = ColumnAdder.NewIntegerInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, defaultValue, notNull);
|
108
|
stepList.add(step);
|
109
|
|
110
|
//SingleReadAlignment rightCutPosition
|
111
|
stepName = "Add rightCutPosition";
|
112
|
tableName = "SingleReadAlignment";
|
113
|
newColumnName = "rightCutPosition";
|
114
|
step = ColumnAdder.NewIntegerInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, defaultValue, notNull);
|
115
|
stepList.add(step);
|
116
|
|
117
|
//DescriptionElementBase_StateData
|
118
|
stepName = "Simplify DescriptionElementBase_StateData";
|
119
|
tableName = "DescriptionElementBase_StateData";
|
120
|
newColumnName = "categoricaldata_id";
|
121
|
step = MnTableRemover.NewInstance(stepName,
|
122
|
tableName,
|
123
|
newColumnName,
|
124
|
"DescriptionElementBase_id",
|
125
|
"statedata_id",
|
126
|
"DescriptionElementBase",
|
127
|
"StateData",
|
128
|
INCLUDE_AUDIT);
|
129
|
stepList.add(step);
|
130
|
|
131
|
//DescriptionElementBase_StatisticalMeasurementValue
|
132
|
stepName = "Simplify DescriptionElementBase_StatisticalMeasurementValue";
|
133
|
tableName = "DescriptionElementBase_StatisticalMeasurementValue";
|
134
|
newColumnName = "quantitativedata_id";
|
135
|
step = MnTableRemover.NewInstance(stepName,
|
136
|
tableName,
|
137
|
newColumnName,
|
138
|
"DescriptionElementBase_id",
|
139
|
"statisticalvalues_id",
|
140
|
"DescriptionElementBase",
|
141
|
"StatisticalMeasurementValue",
|
142
|
INCLUDE_AUDIT);
|
143
|
stepList.add(step);
|
144
|
|
145
|
//TaxonNodeAgentRelation
|
146
|
//#3583
|
147
|
stepName = "Add TaxonNodeAgentRelation table";
|
148
|
tableName = "TaxonNodeAgentRelation";
|
149
|
columnNames = new String[]{"taxonnode_id","agent_id","type_id"};
|
150
|
referencedTables = new String[]{"TaxonNode","AgentBase","DefinedTermBase"};
|
151
|
columnTypes = new String[]{"int","int","int"};
|
152
|
step = TableCreator.NewAnnotatableInstance(stepName, tableName, columnNames, columnTypes, referencedTables, INCLUDE_AUDIT);
|
153
|
stepList.add(step);
|
154
|
|
155
|
return stepList;
|
156
|
}
|
157
|
|
158
|
|
159
|
@Override
|
160
|
public ISchemaUpdater getNextUpdater() {
|
161
|
return null;
|
162
|
}
|
163
|
|
164
|
@Override
|
165
|
public ISchemaUpdater getPreviousUpdater() {
|
166
|
return SchemaUpdater_341_35.NewInstance();
|
167
|
}
|
168
|
|
169
|
}
|