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_51;
|
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.ColumnAdder;
|
18
|
import eu.etaxonomy.cdm.database.update.ColumnRemover;
|
19
|
import eu.etaxonomy.cdm.database.update.ISchemaUpdater;
|
20
|
import eu.etaxonomy.cdm.database.update.ISchemaUpdaterStep;
|
21
|
import eu.etaxonomy.cdm.database.update.SchemaUpdaterBase;
|
22
|
import eu.etaxonomy.cdm.database.update.SimpleSchemaUpdaterStep;
|
23
|
import eu.etaxonomy.cdm.database.update.v47_50.SchemaUpdater_47_50;
|
24
|
|
25
|
/**
|
26
|
/**
|
27
|
* @author a.mueller
|
28
|
* @date 09.06.2017
|
29
|
*
|
30
|
*/
|
31
|
public class SchemaUpdater_50_55 extends SchemaUpdaterBase {
|
32
|
|
33
|
@SuppressWarnings("unused")
|
34
|
private static final Logger logger = Logger.getLogger(SchemaUpdater_50_55.class);
|
35
|
private static final String startSchemaVersion = "5.0.0.0.20180514";
|
36
|
private static final String endSchemaVersion = "5.5.0.0.20190122";
|
37
|
|
38
|
// ********************** FACTORY METHOD *************************************
|
39
|
|
40
|
public static SchemaUpdater_50_55 NewInstance() {
|
41
|
return new SchemaUpdater_50_55();
|
42
|
}
|
43
|
|
44
|
/**
|
45
|
* @param startSchemaVersion
|
46
|
* @param endSchemaVersion
|
47
|
*/
|
48
|
protected SchemaUpdater_50_55() {
|
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 newColumnName;
|
59
|
String query;
|
60
|
|
61
|
List<ISchemaUpdaterStep> stepList = new ArrayList<>();
|
62
|
|
63
|
|
64
|
//#6699 delete term version
|
65
|
//just in case not fixed before yet
|
66
|
stepName = "Delete term version";
|
67
|
query = "DELETE FROM @@CdmMetaData@@ WHERE propertyName = 'TERM_VERSION'";
|
68
|
step = SimpleSchemaUpdaterStep.NewNonAuditedInstance(stepName, query, -99);
|
69
|
stepList.add(step);
|
70
|
|
71
|
//#7414 remove mediaCreatedOld column
|
72
|
stepName = "remove mediaCreatedOld column";
|
73
|
tableName = "Media";
|
74
|
String oldColumnName = "mediaCreatedOld";
|
75
|
step = ColumnRemover.NewInstance(stepName, tableName, oldColumnName, INCLUDE_AUDIT);
|
76
|
stepList.add(step);
|
77
|
|
78
|
//TODO remove proparte and partial columns
|
79
|
|
80
|
//#8004 add sortindex to description element
|
81
|
stepName = "Add sortindex to description element";
|
82
|
tableName = "DescriptionElementBase";
|
83
|
newColumnName = "sortIndex";
|
84
|
step = ColumnAdder.NewIntegerInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, null, !NOT_NULL);
|
85
|
stepList.add(step);
|
86
|
|
87
|
//7682 update Point.precision from 0 to null
|
88
|
stepName = "update Point.precision from 0 to null";
|
89
|
query = "UPDATE @@GatheringEvent@@ SET exactLocation_errorRadius = null WHERE exactLocation_errorRadius = 0 ";
|
90
|
tableName = "GatheringEvent";
|
91
|
step = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, query, tableName, -99);
|
92
|
stepList.add(step);
|
93
|
|
94
|
return stepList;
|
95
|
|
96
|
}
|
97
|
|
98
|
|
99
|
@Override
|
100
|
public ISchemaUpdater getNextUpdater() {
|
101
|
return null;
|
102
|
}
|
103
|
|
104
|
@Override
|
105
|
public ISchemaUpdater getPreviousUpdater() {
|
106
|
return SchemaUpdater_47_50.NewInstance();
|
107
|
}
|
108
|
|
109
|
}
|