Project

General

Profile

Revision f3d4c9bc

IDf3d4c9bc352e0b8ddeb8ca5cd0b0faf8c20a0d53
Parent c1bd6833
Child f83def50

Added by Andreas Müller over 2 years ago

Fix proparte is null in update script

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v40_41/SchemaUpdater_40_41.java
336 336
        String updateSql = "UPDATE @@TaxonBase@@ syn " +
337 337
                " SET proParte = (SELECT DISTINCT proParte FROM @@SynonymRelationship@@ sr WHERE sr.relatedFrom_id = syn.id) " +
338 338
                " WHERE acceptedTaxon_id IS NULL ";
339
//        -- WHERE EXISTS (SELECT proParte FROM SynonymRelationship sr WHERE sr.relatedFrom_id = syn.id AND sr.proParte = 1);
340 339
        step = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, updateSql, "TaxonBase", -99)
341 340
                //.addDefaultAuditing("SynonymRelationship")  //difficult to implement due to non-uniqueness in subquery
342 341
                ;
343 342
        stepList.add(step);
344 343

  
344
        updateSql = "UPDATE @@TaxonBase@@ " +
345
                " SET proParte = @FALSE@ " +
346
                " WHERE DTYPE='Synonym' AND proParte IS NULL ";
347
        step = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, updateSql, "TaxonBase", -99);
348
        stepList.add(step);
349

  
350

  
345 351
        //update partial
346 352
        stepName = "Update partial";
347 353
        updateSql = "UPDATE @@TaxonBase@@ syn " +
......
352 358
                ;
353 359
        stepList.add(step);
354 360

  
361
        updateSql = "UPDATE @@TaxonBase@@ " +
362
                " SET partial = @FALSE@ " +
363
                " WHERE DTYPE='Synonym' AND partial IS NULL ";
364
        step = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, updateSql, "TaxonBase", -99);
365
        stepList.add(step);
366

  
355 367
        //update synonym type
356 368
        stepName = "Update Synonym type";
357 369
        updateSql = "UPDATE @@TaxonBase@@ syn " +
......
370 382
        step = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, updateSql, "TaxonBase", -99);
371 383
        stepList.add(step);
372 384

  
385

  
386

  
373 387
	    //rename SynonymRelationshipType to SynonymType in DefinedTermBase.DTYPE
374 388
        stepName = "Rename SynonymRelationshipType to SynonymType in DefinedTermBase.DTYPE";
375 389
        updateSql = "UPDATE DefinedTermBase SET DTYPE='SynonymType' WHERE DTYPE='SynonymRelationshipType'";

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)