Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

2 changed files:

Changes:

  • core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.java
    ... ... @@ -23,6 +23,7 @@ package fr.ird.observe.spi.migration.v9;
    23 23
      */
    
    24 24
     
    
    25 25
     import com.google.auto.service.AutoService;
    
    26
    +import fr.ird.observe.spi.context.DataDtoEntityContext;
    
    26 27
     import fr.ird.observe.spi.migration.ByMajorMigrationVersionResource;
    
    27 28
     import io.ultreia.java4all.util.Version;
    
    28 29
     import io.ultreia.java4all.util.sql.SqlQuery;
    
    ... ... @@ -32,9 +33,13 @@ import org.apache.logging.log4j.Logger;
    32 33
     import org.nuiton.topia.service.migration.resources.MigrationVersionResource;
    
    33 34
     import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor;
    
    34 35
     
    
    36
    +import java.sql.ResultSet;
    
    37
    +import java.sql.SQLException;
    
    38
    +import java.sql.Timestamp;
    
    35 39
     import java.util.List;
    
    36 40
     import java.util.Map;
    
    37 41
     import java.util.Set;
    
    42
    +import java.util.TreeMap;
    
    38 43
     
    
    39 44
     /**
    
    40 45
      * Created on 19/01/2021.
    
    ... ... @@ -124,6 +129,11 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe
    124 129
     
    
    125 130
             addNewTable(executor, withIds, "03", "table-ps_observation_catch", "table-ps_observation_sample");
    
    126 131
     
    
    132
    +        if (withIds) {
    
    133
    +            // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2436
    
    134
    +            migrateSample(executor);
    
    135
    +        }
    
    136
    +
    
    127 137
             executor.addScript("04_0", "adapt_table-ps_observation_activity");
    
    128 138
             executor.addScript("04_1", "adapt_table-ps_observation_set");
    
    129 139
     
    
    ... ... @@ -189,6 +199,310 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe
    189 199
             }
    
    190 200
         }
    
    191 201
     
    
    202
    +    static class Sample {
    
    203
    +        String topiaId;
    
    204
    +        long topiaVersion;
    
    205
    +        Timestamp topiaCreateDate;
    
    206
    +        Timestamp lastUpdateDate;
    
    207
    +        String homeId;
    
    208
    +        String comment;
    
    209
    +        String set;
    
    210
    +
    
    211
    +        public Sample(ResultSet resultSet) throws SQLException {
    
    212
    +            this.topiaId = resultSet.getString(1);
    
    213
    +            this.topiaVersion = resultSet.getLong(2);
    
    214
    +            this.topiaCreateDate = resultSet.getTimestamp(3);
    
    215
    +            this.homeId = resultSet.getString(4);
    
    216
    +            this.comment = resultSet.getString(5);
    
    217
    +            this.set = resultSet.getString(6);
    
    218
    +            this.lastUpdateDate = resultSet.getTimestamp(7);
    
    219
    +        }
    
    220
    +
    
    221
    +        public void addHomeId(String homeId) {
    
    222
    +            if (homeId == null) {
    
    223
    +                return;
    
    224
    +            }
    
    225
    +            if (this.homeId == null) {
    
    226
    +                this.homeId = homeId;
    
    227
    +                return;
    
    228
    +            }
    
    229
    +            this.homeId += " - " + homeId;
    
    230
    +        }
    
    231
    +
    
    232
    +        public void addComment(String comment) {
    
    233
    +            if (comment == null) {
    
    234
    +                return;
    
    235
    +            }
    
    236
    +            if (this.comment == null) {
    
    237
    +                this.comment = comment;
    
    238
    +                return;
    
    239
    +            }
    
    240
    +            this.comment += " - " + comment;
    
    241
    +        }
    
    242
    +
    
    243
    +    }
    
    244
    +
    
    245
    +
    
    246
    +    static class SampleMeasure {
    
    247
    +        String topiaId;
    
    248
    +        long topiaVersion;
    
    249
    +        Timestamp topiaCreateDate;
    
    250
    +        Timestamp lastUpdateDate;
    
    251
    +        String homeId;
    
    252
    +        Float length;
    
    253
    +        Boolean isLengthComputed;
    
    254
    +        String picturesReferences;
    
    255
    +        Float weight;
    
    256
    +        Boolean isWeightComputed;
    
    257
    +        int count;
    
    258
    +        int acquisitionMode;
    
    259
    +        String species;
    
    260
    +        String sample;
    
    261
    +        String sex;
    
    262
    +        String sizeMeasureType;
    
    263
    +        String weightMeasureType;
    
    264
    +        String tagNumber;
    
    265
    +        String speciesFate;
    
    266
    +        int sample_idx;
    
    267
    +        String lengthMeasureMethod;
    
    268
    +        String weightMeasureMethod;
    
    269
    +
    
    270
    +        public SampleMeasure(ResultSet resultSet) throws SQLException {
    
    271
    +            this.topiaId = resultSet.getString(1);
    
    272
    +            this.topiaVersion = resultSet.getLong(2);
    
    273
    +            this.topiaCreateDate = resultSet.getTimestamp(3);
    
    274
    +            this.homeId = resultSet.getString(4);
    
    275
    +            this.length = resultSet.getFloat(5);
    
    276
    +            this.isLengthComputed = resultSet.getBoolean(6);
    
    277
    +            this.picturesReferences = resultSet.getString(7);
    
    278
    +            this.weight = resultSet.getFloat(8);
    
    279
    +            this.isWeightComputed = resultSet.getBoolean(9);
    
    280
    +            this.count = resultSet.getInt(10);
    
    281
    +            this.acquisitionMode = resultSet.getInt(11);
    
    282
    +            this.species = resultSet.getString(12);
    
    283
    +            this.sample = resultSet.getString(13);
    
    284
    +            this.sex = resultSet.getString(14);
    
    285
    +            this.lastUpdateDate = resultSet.getTimestamp(15);
    
    286
    +            this.sizeMeasureType = resultSet.getString(16);
    
    287
    +            this.weightMeasureType = resultSet.getString(17);
    
    288
    +            this.tagNumber = resultSet.getString(18);
    
    289
    +            this.speciesFate = resultSet.getString(19);
    
    290
    +            this.sample_idx = resultSet.getInt(20);
    
    291
    +            this.lengthMeasureMethod = resultSet.getString(21);
    
    292
    +            this.weightMeasureMethod = resultSet.getString(22);
    
    293
    +        }
    
    294
    +
    
    295
    +    }
    
    296
    +
    
    297
    +    private void migrateSample(MigrationVersionResourceExecutor executor) {
    
    298
    +
    
    299
    +        Map<String, Sample> setToSampleMap = new TreeMap<>();
    
    300
    +        Map<String, String> sampleMapping = new TreeMap<>();
    
    301
    +
    
    302
    +        addSample(executor, setToSampleMap, sampleMapping, "SELECT REPLACE(topiaId, '.NonTargetSample', '.Sample'), topiaVersion, topiaCreateDate, homeId, substr(trim(comment), 0, 1024), set, lastUpdateDate FROM ps_observation.nontargetsample order by set, topiaId");
    
    303
    +
    
    304
    +        addSample(executor, setToSampleMap, sampleMapping, "SELECT REPLACE(topiaId, '.TargetSample', '.Sample'), topiaVersion, topiaCreateDate, homeId, substr(trim(comment), 0, 1024), set, lastUpdateDate FROM ps_observation.targetsample order by set, topiaId");
    
    305
    +
    
    306
    +        //fr.ird.data.ps.observation.Set#1307366814753#0.10928986819912401
    
    307
    +        //fr.ird.data.ps.observation.Sample#1307366814761#0.8029664353471644
    
    308
    +        for (Sample sample : setToSampleMap.values()) {
    
    309
    +            executor.writeSql(String.format("INSERT INTO ps_observation.Sample(topiaId, topiaVersion, topiaCreateDate, homeId, comment, set, lastUpdateDate) VALUES('%s', %s, '%s'::timestamp, %s, %s, '%s', '%s'::timestamp);",
    
    310
    +                                            sample.topiaId,
    
    311
    +                                            sample.topiaVersion,
    
    312
    +                                            sample.topiaCreateDate,
    
    313
    +                                            DataDtoEntityContext.escapeString(sample.homeId),
    
    314
    +                                            DataDtoEntityContext.escapeComment(sample.comment),
    
    315
    +                                            sample.set,
    
    316
    +                                            sample.lastUpdateDate
    
    317
    +            ));
    
    318
    +        }
    
    319
    +
    
    320
    +        migrateSampleMeasure(executor, sampleMapping);
    
    321
    +    }
    
    322
    +
    
    323
    +    private void migrateSampleMeasure(MigrationVersionResourceExecutor executor, Map<String, String> sampleMapping) {
    
    324
    +        // nonTargetSampleMeasure
    
    325
    +        addSampleMeasure(executor, sampleMapping, "SELECT " +
    
    326
    +                "REPLACE(topiaId, '.NonTargetLength', '.SampleMeasure'), " +
    
    327
    +                "topiaVersion + 1, " +
    
    328
    +                "topiaCreateDate, " +
    
    329
    +                "homeId, " +
    
    330
    +                "length, " +
    
    331
    +                "isLengthComputed, " +
    
    332
    +                "picturesReferences, " +
    
    333
    +                "weight, " +
    
    334
    +                "isWeightComputed, " +
    
    335
    +                "count, " +
    
    336
    +                "acquisitionMode, " +
    
    337
    +                "species, " +
    
    338
    +                "REPLACE(nonTargetSample, '.NonTargetSample', '.Sample'), " +
    
    339
    +                "sex, " +
    
    340
    +                "lastUpdateDate, " +
    
    341
    +                "sizeMeasureType, " +
    
    342
    +                "weightMeasureType, " +
    
    343
    +                "tagNumber, " +
    
    344
    +                "speciesFate, " +
    
    345
    +                "nonTargetSample_idx, " +
    
    346
    +                "lengthMeasureMethod, " +
    
    347
    +                "weightMeasureMethod " +
    
    348
    +                "FROM ps_observation.NonTargetLength");
    
    349
    +
    
    350
    +        // discardedTargetSampleMeasure
    
    351
    +        addSampleMeasure(executor, sampleMapping, "SELECT " +
    
    352
    +                "REPLACE(tl.topiaId, '.TargetLength', '.SampleMeasure'), " +
    
    353
    +                "tl.topiaVersion + 1, " +
    
    354
    +                "tl.topiaCreateDate, " +
    
    355
    +                "tl.homeId, " +
    
    356
    +                "tl.length, " +
    
    357
    +                "tl.isLengthComputed, " +
    
    358
    +                "NULL, " +
    
    359
    +                "tl.weight, " +
    
    360
    +                "tl.isWeightComputed, " +
    
    361
    +                "tl.count, " +
    
    362
    +                "tl.acquisitionMode, " +
    
    363
    +                "tl.species, " +
    
    364
    +                "REPLACE(tl.targetSample, '.TargetSample', '.Sample'), " +
    
    365
    +                "'fr.ird.referential.common.Sex#1239832686121#0.0', " +
    
    366
    +                "tl.lastUpdateDate, " +
    
    367
    +                "tl.sizeMeasureType, " +
    
    368
    +                "tl.weightMeasureType, " +
    
    369
    +                "tl.tagNumber, " +
    
    370
    +                "'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.6250731662108877', " +
    
    371
    +                "-tl.targetsample_idx, " +
    
    372
    +                "tl.lengthMeasureMethod, " +
    
    373
    +                "tl.weightMeasureMethod " +
    
    374
    +                "FROM ps_observation.TargetSample ts " +
    
    375
    +                "INNER JOIN ps_observation.TargetLength tl ON (tl.targetSample=ts.topiaId) " +
    
    376
    +                "WHERE ts.discarded");
    
    377
    +
    
    378
    +        // notDiscardedTargetSampleMeasure
    
    379
    +        addSampleMeasure(executor, sampleMapping, "SELECT " +
    
    380
    +                "REPLACE(tl.topiaId, '.TargetLength', '.SampleMeasure'), " +
    
    381
    +                "tl.topiaVersion + 1, " +
    
    382
    +                "tl.topiaCreateDate, " +
    
    383
    +                "tl.homeId, " +
    
    384
    +                "tl.length, " +
    
    385
    +                "tl.isLengthComputed, " +
    
    386
    +                "NULL, " +
    
    387
    +                "tl.weight, " +
    
    388
    +                "tl.isWeightComputed, " +
    
    389
    +                "tl.count, " +
    
    390
    +                "tl.acquisitionMode, " +
    
    391
    +                "tl.species, " +
    
    392
    +                "REPLACE(tl.targetSample, '.TargetSample', '.Sample'), " +
    
    393
    +                "'fr.ird.referential.common.Sex#1239832686121#0.0', " +
    
    394
    +                "tl.lastUpdateDate, " +
    
    395
    +                "tl.sizeMeasureType, " +
    
    396
    +                "tl.weightMeasureType, " +
    
    397
    +                "tl.tagNumber, " +
    
    398
    +                "'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5722739932065866', " +
    
    399
    +                "-tl.targetsample_idx, " +
    
    400
    +                "tl.lengthMeasureMethod, " +
    
    401
    +                "tl.weightMeasureMethod " +
    
    402
    +                "FROM ps_observation.TargetSample ts " +
    
    403
    +                "INNER JOIN ps_observation.TargetLength tl ON (tl.targetSample=ts.topiaId) " +
    
    404
    +                "WHERE NOT ts.discarded");
    
    405
    +    }
    
    406
    +
    
    407
    +    private void addSample(MigrationVersionResourceExecutor executor, Map<String, Sample> setToSampleMap, Map<String, String> sampleMapping, String query) {
    
    408
    +        List<Sample> targetSample = executor.findMultipleResult(SqlQuery.wrap(query, Sample::new));
    
    409
    +        for (Sample sample : targetSample) {
    
    410
    +            Sample existingSample = setToSampleMap.get(sample.set);
    
    411
    +            if (existingSample == null) {
    
    412
    +                // new sample
    
    413
    +                setToSampleMap.put(sample.set, sample);
    
    414
    +//                sampleMapping.put(sample.topiaId, sample.topiaId);
    
    415
    +            } else {
    
    416
    +                // add to sample mapping
    
    417
    +                sampleMapping.put(sample.topiaId, existingSample.topiaId);
    
    418
    +                // update homeId
    
    419
    +                existingSample.addHomeId(sample.homeId);
    
    420
    +                // update comment
    
    421
    +                existingSample.addComment(sample.comment);
    
    422
    +            }
    
    423
    +        }
    
    424
    +    }
    
    425
    +
    
    426
    +    private void addSampleMeasure(MigrationVersionResourceExecutor executor, Map<String, String> sampleMapping, String query) {
    
    427
    +        List<SampleMeasure> sampleMeasureList = executor.findMultipleResult(SqlQuery.wrap(query, SampleMeasure::new));
    
    428
    +        for (SampleMeasure sampleMeasure : sampleMeasureList) {
    
    429
    +            String sampleId = sampleMapping.get(sampleMeasure.sample);
    
    430
    +            if (sampleId == null) {
    
    431
    +                sampleId = sampleMeasure.sample;
    
    432
    +            }
    
    433
    +            executor.writeSql(String.format("INSERT INTO ps_observation.SampleMeasure(" +
    
    434
    +                                                    " topiaId," +
    
    435
    +                                                    " topiaVersion," +
    
    436
    +                                                    " topiaCreateDate," +
    
    437
    +                                                    " homeId," +
    
    438
    +                                                    " length," +
    
    439
    +                                                    " isLengthComputed," +
    
    440
    +                                                    " picturesReferences," +
    
    441
    +                                                    " weight," +
    
    442
    +                                                    " isWeightComputed," +
    
    443
    +                                                    " count," +
    
    444
    +                                                    " acquisitionMode," +
    
    445
    +                                                    " species," +
    
    446
    +                                                    " sample," +
    
    447
    +                                                    " sex," +
    
    448
    +                                                    " lastUpdateDate," +
    
    449
    +                                                    " sizeMeasureType," +
    
    450
    +                                                    " weightMeasureType," +
    
    451
    +                                                    " tagNumber," +
    
    452
    +                                                    " speciesFate," +
    
    453
    +                                                    " sample_idx," +
    
    454
    +                                                    " lengthMeasureMethod," +
    
    455
    +                                                    " weightMeasureMethod)" +
    
    456
    +                                                    " VALUES(" +
    
    457
    +                                                    "'%s', " +
    
    458
    +                                                    "%s, " +
    
    459
    +                                                    "'%s'::timestamp, " +
    
    460
    +                                                    "%s, " +
    
    461
    +                                                    "%s, " +
    
    462
    +                                                    "%s, " +
    
    463
    +                                                    "%s, " +
    
    464
    +                                                    "%s, " +
    
    465
    +                                                    "%s, " +
    
    466
    +                                                    "%s, " +
    
    467
    +                                                    "%s, " +
    
    468
    +                                                    "%s, " +
    
    469
    +                                                    "'%s', " +
    
    470
    +                                                    "%s, " +
    
    471
    +                                                    "'%s'::timestamp, " +
    
    472
    +                                                    "%s, " +
    
    473
    +                                                    "%s, " +
    
    474
    +                                                    "%s, " +
    
    475
    +                                                    "%s, " +
    
    476
    +                                                    "%s, " +
    
    477
    +                                                    "%s, " +
    
    478
    +                                                    "%s " +
    
    479
    +                                                    ");",
    
    480
    +                                            sampleMeasure.topiaId,
    
    481
    +                                            sampleMeasure.topiaVersion,
    
    482
    +                                            sampleMeasure.topiaCreateDate,
    
    483
    +                                            DataDtoEntityContext.escapeString(sampleMeasure.homeId == null ? null : sampleMeasure.homeId.replaceAll("'", "")),
    
    484
    +                                            sampleMeasure.length,
    
    485
    +                                            sampleMeasure.isLengthComputed,
    
    486
    +                                            DataDtoEntityContext.escapeString(sampleMeasure.picturesReferences == null ? null : sampleMeasure.picturesReferences.replaceAll("'", "")),
    
    487
    +                                            sampleMeasure.weight,
    
    488
    +                                            sampleMeasure.isWeightComputed,
    
    489
    +                                            sampleMeasure.count,
    
    490
    +                                            sampleMeasure.acquisitionMode,
    
    491
    +                                            DataDtoEntityContext.escapeString(sampleMeasure.species),
    
    492
    +                                            sampleId,
    
    493
    +                                            DataDtoEntityContext.escapeString(sampleMeasure.sex),
    
    494
    +                                            sampleMeasure.lastUpdateDate,
    
    495
    +                                            DataDtoEntityContext.escapeString(sampleMeasure.sizeMeasureType),
    
    496
    +                                            DataDtoEntityContext.escapeString(sampleMeasure.weightMeasureType),
    
    497
    +                                            DataDtoEntityContext.escapeString(sampleMeasure.tagNumber),
    
    498
    +                                            DataDtoEntityContext.escapeString(sampleMeasure.speciesFate),
    
    499
    +                                            sampleMeasure.sample_idx,
    
    500
    +                                            DataDtoEntityContext.escapeString(sampleMeasure.lengthMeasureMethod),
    
    501
    +                                            DataDtoEntityContext.escapeString(sampleMeasure.weightMeasureMethod)
    
    502
    +            ));
    
    503
    +        }
    
    504
    +    }
    
    505
    +
    
    192 506
         @Override
    
    193 507
         public void generateFinalizeSqlScript(MigrationVersionResourceExecutor executor) {
    
    194 508
             migrateIdx(executor, "ps_observation", "catch", "set");
    

  • core/persistence/resources/src/main/resources/db/migration/v9/9.0/03_fill-table-ps_observation_sample-common.sql
    ... ... @@ -20,14 +20,6 @@
    20 20
     -- #L%
    
    21 21
     ---
    
    22 22
     
    
    23
    -INSERT INTO ps_observation.Sample(topiaId, topiaVersion, topiaCreateDate, homeId, comment, set, lastUpdateDate) SELECT REPLACE(topiaId, '.NonTargetSample', '.Sample'), topiaVersion, topiaCreateDate, homeId, substr(trim(comment), 0, 1024), set, lastUpdateDate FROM ps_observation.nontargetsample;
    
    24
    -INSERT INTO ps_observation.Sample(topiaId, topiaVersion, topiaCreateDate, homeId, comment, set, lastUpdateDate) SELECT REPLACE(topiaId, '.TargetSample', '.Sample'), topiaVersion, topiaCreateDate, homeId, substr(trim(comment), 0, 1024), set, lastUpdateDate FROM ps_observation.TargetSample;
    
    25
    -
    
    26
    -
    
    27
    -INSERT INTO ps_observation.SampleMeasure(topiaId, topiaVersion, topiaCreateDate, homeId, length, isLengthComputed, picturesReferences, weight, isWeightComputed, count, acquisitionMode, species, sample, sex, lastUpdateDate, sizeMeasureType,weightMeasureType, tagNumber, speciesFate, sample_idx, lengthMeasureMethod, weightMeasureMethod) SELECT REPLACE(topiaId, '.NonTargetLength', '.SampleMeasure'), topiaVersion + 1, topiaCreateDate, homeId, length, isLengthComputed, picturesReferences, weight, isWeightComputed, count, acquisitionMode, species, REPLACE(nonTargetSample, '.NonTargetSample', '.Sample'), sex, lastUpdateDate, sizeMeasureType, weightMeasureType, tagNumber, speciesFate, nonTargetSample_idx, lengthMeasureMethod, weightMeasureMethod FROM ps_observation.NonTargetLength;
    
    28
    -INSERT INTO ps_observation.SampleMeasure(topiaId, topiaVersion, topiaCreateDate, homeId, length, isLengthComputed,  weight, isWeightComputed, count, acquisitionMode, species, sample, sex, lastUpdateDate, sizeMeasureType, weightMeasureType,tagNumber, speciesFate, sample_idx, lengthMeasureMethod, weightMeasureMethod) SELECT REPLACE(tl.topiaId, '.TargetLength', '.SampleMeasure'), tl.topiaVersion + 1, tl.topiaCreateDate, tl.homeId, tl.length, tl.isLengthComputed,  tl.weight, tl.isWeightComputed, tl.count, tl.acquisitionMode, tl.species, REPLACE(tl.targetSample, '.TargetSample', '.Sample'), 'fr.ird.referential.common.Sex#1239832686121#0.0', tl.lastUpdateDate, tl.sizeMeasureType, tl.weightMeasureType,  tl.tagNumber, 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.6250731662108877', -tl.targetsample_idx, tl.lengthMeasureMethod, tl.weightMeasureMethod FROM ps_observation.TargetSample ts INNER JOIN ps_observation.TargetLength tl ON (tl.targetSample=ts.topiaId)  WHERE ts.discarded;
    
    29
    -INSERT INTO ps_observation.SampleMeasure(topiaId, topiaVersion, topiaCreateDate, homeId, length, isLengthComputed,  weight, isWeightComputed, count, acquisitionMode, species, sample, sex, lastUpdateDate, sizeMeasureType, weightMeasureType,tagNumber, speciesFate, sample_idx, lengthMeasureMethod, weightMeasureMethod) SELECT REPLACE(tl.topiaId, '.TargetLength', '.SampleMeasure'), tl.topiaVersion + 1, tl.topiaCreateDate, tl.homeId, tl.length, tl.isLengthComputed,  tl.weight, tl.isWeightComputed, tl.count, tl.acquisitionMode, tl.species, REPLACE(tl.targetSample, '.TargetSample', '.Sample'), 'fr.ird.referential.common.Sex#1239832686121#0.0', tl.lastUpdateDate, tl.sizeMeasureType, tl.weightMeasureType, tl.tagNumber, 'fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5722739932065866', -tl.targetsample_idx, tl.lengthMeasureMethod, tl.weightMeasureMethod FROM ps_observation.TargetSample ts INNER JOIN ps_observation.TargetLength tl ON (tl.targetSample=ts.topiaId)  WHERE NOT ts.discarded;
    
    30
    -
    
    31 23
     UPDATE common.LastUpdateDate SET TYPE = REPLACE(TYPE, '.NonTargetSample', '.Sample') WHERE type = 'fr.ird.observe.entities.data.ps.observation.NonTargetSample';
    
    32 24
     DELETE from common.LastUpdateDate WHERE TYPE LIKE ('%.TargetSample');
    
    33 25
     UPDATE common.LastUpdateDate SET TYPE = REPLACE(TYPE, '.NonTargetLength', '.SampleMeasure')  WHERE type = 'fr.ird.observe.entities.data.ps.observation.NonTargetLength';