Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe Commits: 6192e476 by Tony Chemit at 2020-05-26T10:56:56+02:00 Migration des trip.comment vers trip.homeid incorrecte - Closes #1492 - - - - - 4 changed files: - persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_6.java - test/src/main/resources/db/7.6/dataForTestLongline.sql.gz - test/src/main/resources/db/7.6/dataForTestSeine.sql.gz - test/src/main/resources/db/7.6/referentiel.sql.gz Changes: ===================================== persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_6.java ===================================== @@ -27,12 +27,14 @@ import org.apache.commons.lang3.tuple.Pair; import org.nuiton.topia.persistence.support.TopiaSqlQuery; import org.nuiton.topia.service.migration.resources.MigrationVersionResource; import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor; +import org.nuiton.util.DateUtil; import org.nuiton.version.Versions; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.Date; import java.util.Set; /** @@ -72,7 +74,7 @@ public class DataSourceMigrationForVersion_7_6 extends MigrationVersionResource // Must be a ## starting comment continue; } - String homeId = comment.substring(1, endIndex - 1); + String homeId = comment.substring(1, endIndex); String newComment = endIndex + 1 == comment.length() ? "NULL" : (String.format("'%s'", comment.substring(endIndex + 1).trim().replaceAll("'","''"))); executor.writeSql(String.format("UPDATE observe_seine.trip t SET comment = %s, homeId = '%s', topiaVersion = topiaVersion + 1, lastUpdateDate = CURRENT_TIMESTAMP WHERE t.topiaId = '%s';", newComment, homeId, tripId)); } ===================================== test/src/main/resources/db/7.6/dataForTestLongline.sql.gz ===================================== Binary files a/test/src/main/resources/db/7.6/dataForTestLongline.sql.gz and b/test/src/main/resources/db/7.6/dataForTestLongline.sql.gz differ ===================================== test/src/main/resources/db/7.6/dataForTestSeine.sql.gz ===================================== Binary files a/test/src/main/resources/db/7.6/dataForTestSeine.sql.gz and b/test/src/main/resources/db/7.6/dataForTestSeine.sql.gz differ ===================================== test/src/main/resources/db/7.6/referentiel.sql.gz ===================================== Binary files a/test/src/main/resources/db/7.6/referentiel.sql.gz and b/test/src/main/resources/db/7.6/referentiel.sql.gz differ View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/6192e476919953760f3f9e9bbd... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/6192e476919953760f3f9e9bbd... You're receiving this email because of your account on gitlab.com.