Project

General

Profile

Revision a2533432

IDa253343203f211deb231ea0a60639946504226ed
Parent 0d79c535
Child b153def6

Added by Andreas Müller about 1 year ago

ref #6794 change schema version and add missing attributes to updateScript

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/metadata/CdmMetaData.java
59 59
	 * The last number represents the date of change.
60 60
	 */
61 61
//	private static final String dbSchemaVersion = "5.5.0.0.20190221";
62
//  private static final String dbSchemaVersion = "4.7.0.0.201710040000";
63
    private static final String dbSchemaVersion = "5.5.1.0.201903015";
62
  private static final String dbSchemaVersion = "5.8.0.0.201906020";
63
//    private static final String dbSchemaVersion = "5.5.1.0.201903015";
64 64

  
65 65

  
66 66
	/* END OF CONFUSION */
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TextualTypeDesignation.java
69 69
    @Field(name="text", store=Store.YES)
70 70
    @FieldBridge(impl=MultilanguageTextFieldBridge.class)
71 71
    @NotNull
72
    @Transient
73 72
    private Map<Language, LanguageString> text = new HashMap<>();
74 73

  
75
    @Transient
76 74
    private boolean isVerbatim;
77 75

  
78 76
    @XmlTransient
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/CdmUpdater.java
17 17
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
18 18
import eu.etaxonomy.cdm.database.CdmDataSource;
19 19
import eu.etaxonomy.cdm.database.ICdmDataSource;
20
import eu.etaxonomy.cdm.database.update.v50_55.SchemaUpdater_55_551;
20
import eu.etaxonomy.cdm.database.update.v55_58.SchemaUpdater_55_58;
21 21
import eu.etaxonomy.cdm.model.metadata.CdmMetaData;
22 22

  
23 23
/**
......
74 74
     * @return
75 75
     */
76 76
    private ISchemaUpdater getCurrentSchemaUpdater() {
77
        return SchemaUpdater_55_551.NewInstance();
77
        return SchemaUpdater_55_58.NewInstance();
78 78
    }
79 79

  
80 80
    /**
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/TableCreator.java
447 447
			return this.primaryKeyParams_AUD;
448 448
		}
449 449

  
450
		if (includeCdmBaseAttributes || ! includeCdmBaseAttributes){ //TODO how to handle not CDMBase includes
450
		if (includeCdmBaseAttributes || ! includeCdmBaseAttributes){ //TODO how to handle not CDMBase includes => via this.primaryKeyParams
451 451
			if (! isAudit){
452 452
				result = "id";
453 453
			}else{
......
479 479
		}
480 480
	}
481 481

  
482
	public void setPrimaryKeyParams(String primaryKeyParams, String primaryKeyParams_AUD) {
482
	public TableCreator setPrimaryKeyParams(String primaryKeyParams, String primaryKeyParams_AUD) {
483 483
		this.primaryKeyParams = primaryKeyParams;
484 484
		this.primaryKeyParams_AUD = primaryKeyParams_AUD;
485
		return this;
485 486
	}
486 487

  
487
	public void setUniqueParams(String uniqueParams, String uniqueParams_AUD) {
488
	public TableCreator setUniqueParams(String uniqueParams, String uniqueParams_AUD) {
488 489
		this.uniqueParams = uniqueParams;
489 490
		this.uniqueParams_AUD = uniqueParams_AUD;
491
		return this;
490 492
	}
491 493
}
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v50_55/SchemaUpdater_50_55.java
28 28
import eu.etaxonomy.cdm.database.update.TableNameChanger;
29 29
import eu.etaxonomy.cdm.database.update.TermRepresentationUpdater;
30 30
import eu.etaxonomy.cdm.database.update.v47_50.SchemaUpdater_47_50;
31
import eu.etaxonomy.cdm.database.update.v55_58.SchemaUpdater_55_58;
31 32
import eu.etaxonomy.cdm.model.term.TermType;
32 33

  
33 34
/**
......
489 490

  
490 491
    @Override
491 492
	public ISchemaUpdater getNextUpdater() {
492
		return SchemaUpdater_55_551.NewInstance();
493
		return SchemaUpdater_55_58.NewInstance();
493 494
	}
494 495

  
495 496
	@Override
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v50_55/SchemaUpdater_55_551.java
1
/**
2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9

  
10
package eu.etaxonomy.cdm.database.update.v50_55;
11

  
12
import java.util.ArrayList;
13
import java.util.List;
14

  
15
import org.apache.log4j.Logger;
16

  
17
import eu.etaxonomy.cdm.database.update.ISchemaUpdater;
18
import eu.etaxonomy.cdm.database.update.ISchemaUpdaterStep;
19
import eu.etaxonomy.cdm.database.update.SchemaUpdaterBase;
20

  
21
/**
22
/**
23
 * @author a.mueller
24
 * @date 09.06.2017
25
 *
26
 */
27
public class SchemaUpdater_55_551 extends SchemaUpdaterBase {
28

  
29
	@SuppressWarnings("unused")
30
	private static final Logger logger = Logger.getLogger(SchemaUpdater_55_551.class);
31
	private static final String startSchemaVersion = "5.5.0.0.20190221";
32
	private static final String endSchemaVersion = "5.5.1.0.20190301";
33

  
34
	// ********************** FACTORY METHOD *************************************
35

  
36
	public static SchemaUpdater_55_551 NewInstance() {
37
		return new SchemaUpdater_55_551();
38
	}
39

  
40
	/**
41
	 * @param startSchemaVersion
42
	 * @param endSchemaVersion
43
	 */
44
	protected SchemaUpdater_55_551() {
45
		super(startSchemaVersion, endSchemaVersion);
46
	}
47

  
48
	@Override
49
	protected List<ISchemaUpdaterStep> getUpdaterList() {
50

  
51
		String stepName;
52
		String tableName;
53
		ISchemaUpdaterStep step;
54
		String newColumnName;
55
		String query;
56

  
57
		List<ISchemaUpdaterStep> stepList = new ArrayList<>();
58

  
59

  
60
//		//#6699 delete term version
61
//		//just in case not fixed before yet
62
//		stepName = "Delete term version";
63
//		query = "DELETE FROM @@CdmMetaData@@ WHERE propertyName = 'TERM_VERSION'";
64
//		step = SimpleSchemaUpdaterStep.NewNonAuditedInstance(stepName, query, -99);
65
//        stepList.add(step);
66

  
67

  
68
        //TODO remove proparte and partial columns
69

  
70

  
71
        return stepList;
72

  
73
	}
74

  
75

  
76

  
77
    @Override
78
	public ISchemaUpdater getNextUpdater() {
79
		return null;
80
	}
81

  
82
	@Override
83
	public ISchemaUpdater getPreviousUpdater() {
84
		return SchemaUpdater_50_55.NewInstance();
85
	}
86

  
87
}
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v55_58/SchemaUpdater_55_58.java
1
/**
2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9

  
10
package eu.etaxonomy.cdm.database.update.v55_58;
11

  
12
import java.util.ArrayList;
13
import java.util.List;
14

  
15
import org.apache.log4j.Logger;
16

  
17
import eu.etaxonomy.cdm.common.UTF8;
18
import eu.etaxonomy.cdm.database.update.ColumnAdder;
19
import eu.etaxonomy.cdm.database.update.ColumnNameChanger;
20
import eu.etaxonomy.cdm.database.update.ISchemaUpdater;
21
import eu.etaxonomy.cdm.database.update.ISchemaUpdaterStep;
22
import eu.etaxonomy.cdm.database.update.SchemaUpdaterBase;
23
import eu.etaxonomy.cdm.database.update.SimpleSchemaUpdaterStep;
24
import eu.etaxonomy.cdm.database.update.TableCreator;
25
import eu.etaxonomy.cdm.database.update.TableNameChanger;
26
import eu.etaxonomy.cdm.database.update.v50_55.SchemaUpdater_50_55;
27

  
28
/**
29
 * @author a.mueller
30
 * @date 01.03.2019
31
 */
32
public class SchemaUpdater_55_58 extends SchemaUpdaterBase {
33

  
34
	@SuppressWarnings("unused")
35
	private static final Logger logger = Logger.getLogger(SchemaUpdater_55_58.class);
36

  
37
	private static final String startSchemaVersion = "5.5.0.0.20190221";
38
	private static final String endSchemaVersion = "5.8.0.0.201906020";
39

  
40
	// ********************** FACTORY METHOD *************************************
41

  
42
	public static SchemaUpdater_55_58 NewInstance() {
43
		return new SchemaUpdater_55_58();
44
	}
45

  
46
	/**
47
	 * @param startSchemaVersion
48
	 * @param endSchemaVersion
49
	 */
50
	protected SchemaUpdater_55_58() {
51
		super(startSchemaVersion, endSchemaVersion);
52
	}
53

  
54
	@Override
55
	protected List<ISchemaUpdaterStep> getUpdaterList() {
56

  
57
		String stepName;
58
		String tableName;
59
		ISchemaUpdaterStep step;
60
		String newColumnName;
61
		String query;
62

  
63
		List<ISchemaUpdaterStep> stepList = new ArrayList<>();
64

  
65

  
66
        //TODO remove proparte and partial columns
67

  
68
		updateConceptRelationshipSymbolsAgain(stepList);
69

  
70
	   //******** FeatureNode to TermRelation ******/
71
       //#6794 rename FeatureNode to TermRelation
72
       stepName = "rename FeatureNode to TermRelation";
73
       String oldName = "FeatureNode";
74
       String newName = "TermRelation";
75
       boolean includeDtype = false;
76
       step = TableNameChanger.NewInstance(stepName, oldName, newName, INCLUDE_AUDIT, includeDtype);
77
       stepList.add(step);
78

  
79
       //#6794 add DTYPE to TermRelation
80
       stepName = "add DTYPE to TermRelation";
81
       tableName = "TermRelation";
82
       step = ColumnAdder.NewDTYPEInstance(stepName, tableName, "TermTreeNode", INCLUDE_AUDIT) ;
83
       stepList.add(step);
84

  
85
       //#6794 add root_id column to TermCollection
86
       stepName = "add toTerm_id column to TermRelation";
87
       tableName = "TermRelation";
88
       newColumnName = "toTerm_id";
89
       step = ColumnAdder.NewIntegerInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, !NOT_NULL, "DefinedTermBase");
90
       stepList.add(step);
91

  
92
       //#6794 change featuretree_id to graph_id
93
       stepName = "change featuretree_id to graph_id";
94
       tableName = "TermRelation";
95
       String oldColumnName = "featureTree_id";
96
       newColumnName = "graph_id";
97
       step = ColumnNameChanger.NewIntegerInstance(stepName, tableName, oldColumnName, newColumnName, INCLUDE_AUDIT);
98
       stepList.add(step);
99

  
100
       //#6794 change feature_id to term_id
101
       stepName = "change feature_id to term_id";
102
       tableName = "TermRelation";
103
       oldColumnName = "feature_id";
104
       newColumnName = "term_id";
105
       step = ColumnNameChanger.NewIntegerInstance(stepName, tableName, oldColumnName, newColumnName, INCLUDE_AUDIT);
106
       stepList.add(step);
107

  
108
       //#6794 rename FeatureNode_DefinedTermBase_InapplicableIf to TermTreeNode_DefinedTermBase_InapplicableIf
109
       stepName = "rename FeatureNode_DefinedTermBase_InapplicableIf to TermTreeNode_DefinedTermBase_InapplicableIf";
110
       oldName = "FeatureNode_DefinedTermBase_InapplicableIf";
111
       newName = "TermTreeNode_DefinedTermBase_InapplicableIf";
112
       includeDtype = false;
113
       step = TableNameChanger.NewInstance(stepName, oldName, newName, INCLUDE_AUDIT, includeDtype);
114
       stepList.add(step);
115

  
116
       //#6794 change FeatureNode_id to TermTreeNode_id in TermTreeNode_DefinedTermBase_InapplicableIf
117
       stepName = "change FeatureNode_id to TermTreeNode_id in TermTreeNode_DefinedTermBase_InapplicableIf";
118
       tableName = "TermTreeNode_DefinedTermBase_InapplicableIf";
119
       oldColumnName = "FeatureNode_id";
120
       newColumnName = "TermTreeNode_id";
121
       step = ColumnNameChanger.NewIntegerInstance(stepName, tableName, oldColumnName, newColumnName, INCLUDE_AUDIT);
122
       stepList.add(step);
123

  
124
       //#6794 rename FeatureNode_DefinedTermBase_OnlyApplicable to TermTreeNode_DefinedTermBase_OnlyApplicable
125
       stepName = "rename FeatureNode_DefinedTermBase_InapplicableIf to TermTreeNode_DefinedTermBase_InapplicableIf";
126
       oldName = "FeatureNode_DefinedTermBase_OnlyApplicable";
127
       newName = "TermTreeNode_DefinedTermBase_OnlyApplicable";
128
       includeDtype = false;
129
       step = TableNameChanger.NewInstance(stepName, oldName, newName, INCLUDE_AUDIT, includeDtype);
130
       stepList.add(step);
131

  
132
       //#6794 change FeatureNode_id to TermTreeNode_id in TermTreeNode_DefinedTermBase_OnlyApplicable
133
       stepName = "change FeatureNode_id to TermTreeNode_id in TermTreeNode_DefinedTermBase_OnlyApplicable";
134
       tableName = "TermTreeNode_DefinedTermBase_OnlyApplicable";
135
       oldColumnName = "FeatureNode_id";
136
       newColumnName = "TermTreeNode_id";
137
       step = ColumnNameChanger.NewIntegerInstance(stepName, tableName, oldColumnName, newColumnName, INCLUDE_AUDIT);
138
       stepList.add(step);
139

  
140
       //#6794
141
       renameTermVocToTermCollection(stepList);
142

  
143
       //#6794 add root_id column to TermCollection
144
       stepName = "add root_id column to TermCollection";
145
       tableName = "TermCollection";
146
       newColumnName = "root_id";
147
       step = ColumnAdder.NewIntegerInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, !NOT_NULL, "TermRelation");
148
       stepList.add(step);
149

  
150
       //#6794
151
       addBooleansToTermVocabulary(stepList);
152

  
153
       //#7470
154
       updateFreeTextTypeDesignation(stepList);
155

  
156
       return stepList;
157
	}
158

  
159
    /**
160
     * @param stepList
161
     */
162
    private void addBooleansToTermVocabulary(List<ISchemaUpdaterStep> stepList) {
163
        String stepName;
164
        String tableName;
165
        ISchemaUpdaterStep step;
166
        String newColumnName;
167
        //#6794 add allowDuplicates to TermCollection
168
           stepName = "Add allowDuplicates to TermCollection";
169
           tableName = "TermCollection";
170
           newColumnName = "allowDuplicates";
171
           step = ColumnAdder.NewBooleanInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, false);
172
           stepList.add(step);
173

  
174
           //#6794 add isFlat to TermCollection
175
           stepName = "Add isFlat to TermCollection";
176
           tableName = "TermCollection";
177
           newColumnName = "isFlat";
178
           step = ColumnAdder.NewBooleanInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, false);
179
           stepList.add(step);
180

  
181
           //#6794 add orderRelevant to TermCollection
182
           stepName = "Add orderRelevant to TermCollection";
183
           tableName = "TermCollection";
184
           newColumnName = "orderRelevant";
185
           step = ColumnAdder.NewBooleanInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, false);
186
           stepList.add(step);
187
    }
188

  
189
    /**
190
     * @param stepList
191
     */
192
    private void renameTermVocToTermCollection(List<ISchemaUpdaterStep> stepList) {
193
        //#6794 rename TermVocabulary to TermCollection
194
        String stepName = "rename TermVocabulary to TermCollection";
195
        String oldName = "TermVocabulary";
196
        String newName = "TermCollection";
197
        boolean includeDtype = false;
198
        ISchemaUpdaterStep step = TableNameChanger.NewInstance(stepName, oldName, newName, INCLUDE_AUDIT, includeDtype);
199
        stepList.add(step);
200

  
201
        //#6794 rename TermVocabulary_Annotation to TermCollection_Annotation
202
        stepName = "rename TermVocabulary_Annotation to TermCollection_Annotation";
203
        oldName = "TermVocabulary_Annotation";
204
        newName = "TermCollection_Annotation";
205
        includeDtype = false;
206
        step = TableNameChanger.NewInstance(stepName, oldName, newName, INCLUDE_AUDIT, includeDtype);
207
        stepList.add(step);
208

  
209
        //#6794 rename TermCollection_Annotation.TermVocabulary_id to TermCollection_id
210
        stepName = "rename TermCollection_Annotation.TermVocabulary_id to TermCollection_id";
211
        String tableName = "TermCollection_Annotation";
212
        String oldColumnName = "TermVocabulary_id";
213
        String newColumnName = "TermCollection_id";
214
        step = ColumnNameChanger.NewIntegerInstance(stepName, tableName, oldColumnName, newColumnName, INCLUDE_AUDIT);
215
        stepList.add(step);
216

  
217
        //#6794 rename TermVocabulary_Credit to TermCollection_Credit
218
        stepName = "rename TermVocabulary_Credit to TermCollection_Credit";
219
        oldName = "TermVocabulary_Credit";
220
        newName = "TermCollection_Credit";
221
        includeDtype = false;
222
        step = TableNameChanger.NewInstance(stepName, oldName, newName, INCLUDE_AUDIT, includeDtype);
223
        stepList.add(step);
224

  
225
        //#6794 rename TermCollection_Credit.TermVocabulary_id to TermCollection_id
226
        stepName = "rename TermCollection_Credit.TermVocabulary_id to TermCollection_id";
227
        tableName = "TermCollection_Credit";
228
        oldColumnName = "TermVocabulary_id";
229
        newColumnName = "TermCollection_id";
230
        step = ColumnNameChanger.NewIntegerInstance(stepName, tableName, oldColumnName, newColumnName, INCLUDE_AUDIT);
231
        stepList.add(step);
232

  
233
        //#6794 rename TermVocabulary_Extension to TermCollection_Extension
234
        stepName = "rename TermVocabulary_Extension to TermCollection_Extension";
235
        oldName = "TermVocabulary_Extension";
236
        newName = "TermCollection_Extension";
237
        includeDtype = false;
238
        step = TableNameChanger.NewInstance(stepName, oldName, newName, INCLUDE_AUDIT, includeDtype);
239
        stepList.add(step);
240

  
241
        //#6794 rename TermCollection_Extension.TermVocabulary_id to TermCollection_id
242
        stepName = "rename TermCollection_Extension.TermVocabulary_id to TermCollection_id";
243
        tableName = "TermCollection_Extension";
244
        oldColumnName = "TermVocabulary_id";
245
        newColumnName = "TermCollection_id";
246
        step = ColumnNameChanger.NewIntegerInstance(stepName, tableName, oldColumnName, newColumnName, INCLUDE_AUDIT);
247
        stepList.add(step);
248

  
249
        //#6794 rename TermVocabulary_Identifier to TermCollection_Identifier
250
        stepName = "rename TermVocabulary_Identifier to TermCollection_Identifier";
251
        oldName = "TermVocabulary_Identifier";
252
        newName = "TermCollection_Identifier";
253
        includeDtype = false;
254
        step = TableNameChanger.NewInstance(stepName, oldName, newName, INCLUDE_AUDIT, includeDtype);
255
        stepList.add(step);
256

  
257
        //#6794 rename TermCollection_Identifier.TermVocabulary_id to TermCollection_id
258
        stepName = "rename TermCollection_Identifier.TermVocabulary_id to TermCollection_id";
259
        tableName = "TermCollection_Identifier";
260
        oldColumnName = "TermVocabulary_id";
261
        newColumnName = "TermCollection_id";
262
        step = ColumnNameChanger.NewIntegerInstance(stepName, tableName, oldColumnName, newColumnName, INCLUDE_AUDIT);
263
        stepList.add(step);
264

  
265
        //#6794 rename TermVocabulary_Marker to TermCollection_Marker
266
        stepName = "rename TermVocabulary_Marker to TermCollection_Marker";
267
        oldName = "TermVocabulary_Marker";
268
        newName = "TermCollection_Marker";
269
        includeDtype = false;
270
        step = TableNameChanger.NewInstance(stepName, oldName, newName, INCLUDE_AUDIT, includeDtype);
271
        stepList.add(step);
272

  
273
        //#6794 rename TermCollection_Marker.TermVocabulary_id to TermCollection_id
274
        stepName = "rename TermCollection_Marker.TermVocabulary_id to TermCollection_id";
275
        tableName = "TermCollection_Marker";
276
        oldColumnName = "TermVocabulary_id";
277
        newColumnName = "TermCollection_id";
278
        step = ColumnNameChanger.NewIntegerInstance(stepName, tableName, oldColumnName, newColumnName, INCLUDE_AUDIT);
279
        stepList.add(step);
280

  
281
        //#6794 rename TermVocabulary_OriginalSourceBase to TermCollection_OriginalSourceBase
282
        stepName = "rename TermVocabulary_OriginalSourceBase to TermCollection_OriginalSourceBase";
283
        oldName = "TermVocabulary_OriginalSourceBase";
284
        newName = "TermCollection_OriginalSourceBase";
285
        includeDtype = false;
286
        step = TableNameChanger.NewInstance(stepName, oldName, newName, INCLUDE_AUDIT, includeDtype);
287
        stepList.add(step);
288

  
289
        //#6794 rename TermCollection_OriginalSourceBase.TermVocabulary_id to TermCollection_id
290
        stepName = "rename TermCollection_OriginalSourceBase.TermVocabulary_id to TermCollection_id";
291
        tableName = "TermCollection_OriginalSourceBase";
292
        oldColumnName = "TermVocabulary_id";
293
        newColumnName = "TermCollection_id";
294
        step = ColumnNameChanger.NewIntegerInstance(stepName, tableName, oldColumnName, newColumnName, INCLUDE_AUDIT);
295
        stepList.add(step);
296

  
297
        //#6794 rename TermVocabulary_Representation to TermCollection_Representation
298
        stepName = "rename TermVocabulary_Representation to TermCollection_Representation";
299
        oldName = "TermVocabulary_Representation";
300
        newName = "TermCollection_Representation";
301
        includeDtype = false;
302
        step = TableNameChanger.NewInstance(stepName, oldName, newName, INCLUDE_AUDIT, includeDtype);
303
        stepList.add(step);
304

  
305
        //#6794 rename TermCollection_Representation.TermVocabulary_id to TermCollection_id
306
        stepName = "rename TermCollection_Representation.TermVocabulary_id to TermCollection_id";
307
        tableName = "TermCollection_Representation";
308
        oldColumnName = "TermVocabulary_id";
309
        newColumnName = "TermCollection_id";
310
        step = ColumnNameChanger.NewIntegerInstance(stepName, tableName, oldColumnName, newColumnName, INCLUDE_AUDIT);
311
        stepList.add(step);
312

  
313
        //#6794 rename TermVocabulary_RightsInfo to TermCollection_RightsInfo
314
        stepName = "rename TermVocabulary_RightsInfo to TermCollection_RightsInfo";
315
        oldName = "TermVocabulary_RightsInfo";
316
        newName = "TermCollection_RightsInfo";
317
        includeDtype = false;
318
        step = TableNameChanger.NewInstance(stepName, oldName, newName, INCLUDE_AUDIT, includeDtype);
319
        stepList.add(step);
320

  
321
        //#6794 rename TermCollection_RightsInfo.TermVocabulary_id to TermCollection_id
322
        stepName = "rename TermCollection_RightsInfo.TermVocabulary_id to TermCollection_id";
323
        tableName = "TermCollection_RightsInfo";
324
        oldColumnName = "TermVocabulary_id";
325
        newColumnName = "TermCollection_id";
326
        step = ColumnNameChanger.NewIntegerInstance(stepName, tableName, oldColumnName, newColumnName, INCLUDE_AUDIT);
327
        stepList.add(step);
328

  
329
    }
330

  
331
    /**
332
     * @param stepList
333
     */
334
    private void updateFreeTextTypeDesignation(List<ISchemaUpdaterStep> stepList) {
335
        String stepName = "Add isVerbatim to TypeDesignationBase";
336

  
337
        String tableName = "TypeDesignationBase";
338
        String newColumnName = "isVerbatim";
339
        ISchemaUpdaterStep step = ColumnAdder.NewBooleanInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, false);
340
        stepList.add(step);
341

  
342
        //add TypeDesignationBase_LanguageString
343
        stepName = "add TypeDesignationBase_LanguageString";
344
        tableName = "TypeDesignationBase_LanguageString";
345
        String[] columnNames = new String[]{"TextualTypeDesignation_id","text_id","text_mapkey_id"};
346
        String[] columnTypes = new String[]{"int","int","int"};
347
        String[] referencedTables = new String[]{"TypeDesignationBase","LanguageString","LanguageString"};
348
        TableCreator tableCreator = TableCreator.NewInstance(stepName, tableName, columnNames, columnTypes, referencedTables,
349
                INCLUDE_AUDIT, ! INCLUDE_CDM_BASE)
350
                .setPrimaryKeyParams("TextualTypeDesignation_id, text_id", "REV, TextualTypeDesignation_id, text_id, text_mapkey_id")
351
                .setUniqueParams("text_id", null);
352

  
353

  
354
        //TODO PK on ("TextualTypeDesignation_id","text_id")
355
        //TODO Unique key on "text_id")
356

  
357
        stepList.add(tableCreator);
358
    }
359

  
360
    //7514  the update in 50_55 was not yet correct
361
    private void updateConceptRelationshipSymbolsAgain(List<ISchemaUpdaterStep> stepList) {
362

  
363
        //Update misapplied name symbols
364
        String stepName = "Update misapplied name symbols again";
365
        String query = "UPDATE @@DefinedTermBase@@ "
366
                + " SET symbol='"+UTF8.EM_DASH_DOUBLE+"' , inverseSymbol = '"+UTF8.EN_DASH+"' "
367
                + " WHERE uuid = '1ed87175-59dd-437e-959e-0d71583d8417' ";
368
        String tableName = "DefinedTermBase";
369
        ISchemaUpdaterStep step = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, query, tableName, -99);
370
        stepList.add(step);
371

  
372
        //Update pro parte misapplied name symbols
373
        stepName = "Update pro parte misapplied name symbols again";
374
        query = "UPDATE @@DefinedTermBase@@ "
375
                + " SET symbol='"+UTF8.EM_DASH_DOUBLE+"(p.p.)' , inverseSymbol = '"+UTF8.EN_DASH+"(p.p.)' "
376
                + " WHERE uuid = 'b59b4bd2-11ff-45d1-bae2-146efdeee206' ";
377
        tableName = "DefinedTermBase";
378
        step = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, query, tableName, -99);
379
        stepList.add(step);
380

  
381
        //Update partial misapplied name symbols
382
        stepName = "Update partial misapplied name symbols again";
383
        query = "UPDATE @@DefinedTermBase@@ "
384
                + " SET symbol='"+UTF8.EM_DASH_DOUBLE+"(part.)' , inverseSymbol = '"+UTF8.EN_DASH+"(part.)' "
385
                + " WHERE uuid = '859fb615-b0e8-440b-866e-8a19f493cd36' ";
386
        tableName = "DefinedTermBase";
387
        step = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, query, tableName, -99);
388
        stepList.add(step);
389

  
390

  
391
    }
392

  
393

  
394
    @Override
395
	public ISchemaUpdater getNextUpdater() {
396
		return null;
397
	}
398

  
399
	@Override
400
	public ISchemaUpdater getPreviousUpdater() {
401
		return SchemaUpdater_50_55.NewInstance();
402
	}
403

  
404
}
cdmlib-services/src/test/java/eu/etaxonomy/cdm/test/function/TestModelUpdate.java
46 46

  
47 47
		DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
48 48

  
49
		String database = (schema == DbSchemaValidation.VALIDATE  ? "cdm50" : "cdm55");
49
		String database = (schema == DbSchemaValidation.VALIDATE  ? "cdm55" : "cdm58");
50 50
		CdmDataSource dataSource = getDatasource(dbType, database);
51 51

  
52 52
 		try {

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)