Project

General

Profile

Revision 2c2fb8fe

ID2c2fb8fea13781cf83b9e0d4a41306ed7f3791d8
Parent 3bcb7fc8
Child 062d3624

Added by Andreas Müller about 2 months ago

fix #9082 fix empty partials_start and partials_end handling

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v515_518/SchemaUpdater_5152_5180.java
113 113
                   + " WHERE id IN (SELECT source_id FROM TaxonNode tn)";
114 114
        SimpleSchemaUpdaterStep.NewAuditedInstance(stepList, stepName, sql, tableName, 99);
115 115

  
116
        //9082
117
        //fix empty partials_start and partials_end handling
118
        tableName = "AgentBase";
119
        String columnName ="lifespan";
120
        fixEmptyPartialsHandling(stepList, tableName, columnName);
121
        tableName = "Amplification";
122
        columnName ="timeperiod";
123
        fixEmptyPartialsHandling(stepList, tableName, columnName);
124
        tableName = "DerivationEvent";
125
        fixEmptyPartialsHandling(stepList, tableName, columnName);
126
        tableName = "DeterminationEvent";
127
        fixEmptyPartialsHandling(stepList, tableName, columnName);
128
        tableName = "GatheringEvent";
129
        fixEmptyPartialsHandling(stepList, tableName, columnName);
130
        tableName = "SingleRead";
131
        fixEmptyPartialsHandling(stepList, tableName, columnName);
132
        tableName = "MaterialOrMethodEvent";
133
        fixEmptyPartialsHandling(stepList, tableName, columnName);
134
        tableName = "DescriptionElementBase";
135
        fixEmptyPartialsHandling(stepList, tableName, columnName);
136
        tableName = "Classification";
137
        fixEmptyPartialsHandling(stepList, tableName, columnName);
138
        tableName = "DescriptionElementBase";
139
        columnName ="period";
140
        fixEmptyPartialsHandling(stepList, tableName, columnName);
141
        tableName = "DefinedTermBase";
142
        columnName ="validPeriod";
143
        fixEmptyPartialsHandling(stepList, tableName, columnName);
144
        tableName = "Media";
145
        columnName ="mediaCreated";
146
        fixEmptyPartialsHandling(stepList, tableName, columnName);
147
        tableName = "Reference";
148
        columnName ="datePublished";
149
        fixEmptyPartialsHandling(stepList, tableName, columnName);
116 150

  
117 151
        return stepList;
118 152
    }
119 153

  
154
    //9082
155
    private void fixEmptyPartialsHandling(List<ISchemaUpdaterStep> stepList,
156
            String tableName, String columnName) {
157

  
158
        String stepName = "fix empty partials_start handling for " + tableName;
159
        String sql = "UPDATE @@"+tableName+"@@ "
160
                   + " SET "+columnName+"_start = NULL "
161
                   + " WHERE "+columnName+"_start = '00000000' ";
162
        SimpleSchemaUpdaterStep.NewAuditedInstance(stepList, stepName, sql, tableName, 99);
163

  
164
        stepName = "fix empty partials_end handling for " + tableName;
165
        sql = "UPDATE @@"+tableName+"@@ "
166
                   + " SET "+columnName+"_end = NULL "
167
                   + " WHERE "+columnName+"_end = '00000000'";
168
        SimpleSchemaUpdaterStep.NewAuditedInstance(stepList, stepName, sql, tableName, 99);
169
    }
120 170

  
121 171
    @Override
122 172
    public ISchemaUpdater getPreviousUpdater() {

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)