From 9bf3e16023a709188e53a2105d9211f58b327157 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Feb 2023 21:12:57 +0000 Subject: [PATCH 01/17] Bump maven-compiler-plugin from 3.10.1 to 3.11.0 Bumps [maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.10.1 to 3.11.0. - [Release notes](https://github.com/apache/maven-compiler-plugin/releases) - [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.10.1...maven-compiler-plugin-3.11.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-compiler-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 81d32891..1f4bf728 100644 --- a/pom.xml +++ b/pom.xml @@ -201,7 +201,7 @@ maven-compiler-plugin - 3.10.1 + 3.11.0 17 true From a8e1eb55bc50cd8288ffbfa2b1ab25cfe7185694 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Feb 2023 21:13:04 +0000 Subject: [PATCH 02/17] Bump snakeyaml from 1.33 to 2.0 Bumps [snakeyaml](https://bitbucket.org/snakeyaml/snakeyaml) from 1.33 to 2.0. - [Commits](https://bitbucket.org/snakeyaml/snakeyaml/branches/compare/snakeyaml-2.0..snakeyaml-1.33) --- updated-dependencies: - dependency-name: org.yaml:snakeyaml dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 81d32891..b9ca2592 100644 --- a/pom.xml +++ b/pom.xml @@ -149,7 +149,7 @@ org.yaml snakeyaml - 1.33 + 2.0 test From b2279940d0147f5b8bc4ba199d56cf3a9538e827 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Mar 2023 21:57:14 +0000 Subject: [PATCH 03/17] Bump spring.version from 6.0.5 to 6.0.6 Bumps `spring.version` from 6.0.5 to 6.0.6. Updates `spring-test` from 6.0.5 to 6.0.6 - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v6.0.5...v6.0.6) Updates `spring-jdbc` from 6.0.5 to 6.0.6 - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v6.0.5...v6.0.6) Updates `spring-beans` from 6.0.5 to 6.0.6 - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v6.0.5...v6.0.6) Updates `spring-context` from 6.0.5 to 6.0.6 - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v6.0.5...v6.0.6) Updates `spring-orm` from 6.0.5 to 6.0.6 - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v6.0.5...v6.0.6) --- updated-dependencies: - dependency-name: org.springframework:spring-test dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.springframework:spring-jdbc dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.springframework:spring-beans dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.springframework:spring-context dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.springframework:spring-orm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 81d32891..3dccb56c 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,7 @@ UTF-8 6.1.7.Final - 6.0.5 + 6.0.6 0-SNAPSHOT ${env.GITHUB_TOKEN} From 5837373f83270780190bd6c1fab00ca1f85888b6 Mon Sep 17 00:00:00 2001 From: filipe Date: Tue, 17 Jan 2023 18:17:55 -0300 Subject: [PATCH 04/17] Allows liquibase default column handle to be executed. From 9c1fdc8378b25fb8b85b4d6981fde6a55fb75d46 Mon Sep 17 00:00:00 2001 From: filipe Date: Mon, 13 Mar 2023 09:00:48 -0300 Subject: [PATCH 05/17] Fix snyk warning (#466) * Allows liquibase default column handle to be executed. --- .snyk | 1 - 1 file changed, 1 deletion(-) diff --git a/.snyk b/.snyk index 50b563f8..2f01e789 100644 --- a/.snyk +++ b/.snyk @@ -5,6 +5,5 @@ ignore: SNYK-JAVA-ORGLIQUIBASE-2419059: - '*': reason: ignore liquibase version - expires: 2023-03-07T00:00:00.000Z created: 2022-03-07T15:57:03.089Z patch: {} \ No newline at end of file From 8c779f2b13fa89deb20dcece0cd82bff3a530c49 Mon Sep 17 00:00:00 2001 From: filipe Date: Tue, 17 Jan 2023 18:12:08 -0300 Subject: [PATCH 06/17] Restore previous behavior and handle diff when the size/length of a field changes. --- .../diff/ChangedColumnChangeGenerator.java | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java diff --git a/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java b/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java new file mode 100644 index 00000000..83280233 --- /dev/null +++ b/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java @@ -0,0 +1,73 @@ +package liquibase.ext.hibernate.diff; + +import liquibase.change.Change; +import liquibase.database.Database; +import liquibase.diff.Difference; +import liquibase.diff.ObjectDifferences; +import liquibase.diff.output.DiffOutputControl; +import liquibase.ext.hibernate.database.HibernateDatabase; +import liquibase.statement.DatabaseFunction; +import liquibase.structure.DatabaseObject; +import liquibase.structure.core.Column; +import liquibase.structure.core.DataType; + +import java.util.List; + +/** + * Hibernate and database types tend to look different even though they are not. + * There are enough false positives that it works much better to suppress all column changes based on types. + */ +public class ChangedColumnChangeGenerator extends liquibase.diff.output.changelog.core.ChangedColumnChangeGenerator { + + @Override + public int getPriority(Class objectType, Database database) { + if (Column.class.isAssignableFrom(objectType)) { + return PRIORITY_ADDITIONAL; + } + return PRIORITY_NONE; + } + + @Override + protected void handleTypeDifferences(Column column, ObjectDifferences differences, DiffOutputControl control, List changes, Database referenceDatabase, Database comparisonDatabase) { + if (referenceDatabase instanceof HibernateDatabase || comparisonDatabase instanceof HibernateDatabase) { + handleSizeChange(column, differences, control, changes, referenceDatabase, comparisonDatabase); + } else { + super.handleTypeDifferences(column, differences, control, changes, referenceDatabase, comparisonDatabase); + } + } + + private void handleSizeChange(Column column, ObjectDifferences differences, DiffOutputControl control, List changes, Database referenceDatabase, Database comparisonDatabase) { + Difference difference = differences.getDifference("type"); + if (difference != null) { + for (Difference d : differences.getDifferences()) { + if (!(d.getReferenceValue() instanceof DataType)) { + differences.removeDifference(d.getField()); + continue; + } + int originalSize = ((DataType) d.getReferenceValue()).getColumnSize(); + int newSize = ((DataType) d.getComparedValue()).getColumnSize(); + if (newSize == originalSize) { + differences.removeDifference(d.getField()); + } + } + super.handleTypeDifferences(column, differences, control, changes, referenceDatabase, comparisonDatabase); + } + } + + @Override + protected void handleDefaultValueDifferences(Column column, ObjectDifferences differences, DiffOutputControl control, List changes, Database referenceDatabase, Database comparisonDatabase) { + if (referenceDatabase instanceof HibernateDatabase || comparisonDatabase instanceof HibernateDatabase) { + Difference difference = differences.getDifference("defaultValue"); + if (difference != null && difference.getReferenceValue() == null && difference.getComparedValue() instanceof DatabaseFunction) { + //database sometimes adds a function default value, like for timestamp columns + return; + } + difference = differences.getDifference("defaultValue"); + if (difference != null) { + super.handleDefaultValueDifferences(column, differences, control, changes, referenceDatabase, comparisonDatabase); + } + // do nothing, types tend to not match with hibernate + } + super.handleDefaultValueDifferences(column, differences, control, changes, referenceDatabase, comparisonDatabase); + } +} From 7c75120fc9fafd119f24f45083df81dd8a93ea02 Mon Sep 17 00:00:00 2001 From: filipe Date: Mon, 13 Mar 2023 23:20:04 -0300 Subject: [PATCH 07/17] Register class. --- .../services/liquibase.diff.output.changelog.ChangeGenerator | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/META-INF/services/liquibase.diff.output.changelog.ChangeGenerator b/src/main/resources/META-INF/services/liquibase.diff.output.changelog.ChangeGenerator index b5d2eb3d..28466d96 100644 --- a/src/main/resources/META-INF/services/liquibase.diff.output.changelog.ChangeGenerator +++ b/src/main/resources/META-INF/services/liquibase.diff.output.changelog.ChangeGenerator @@ -1,3 +1,4 @@ +liquibase.ext.hibernate.diff.ChangedColumnChangeGenerator liquibase.ext.hibernate.diff.ChangedForeignKeyChangeGenerator liquibase.ext.hibernate.diff.ChangedSequenceChangeGenerator liquibase.ext.hibernate.diff.MissingSequenceChangeGenerator From aa6077e19e6c27366388358280125df8f3a4b3e2 Mon Sep 17 00:00:00 2001 From: filipe Date: Tue, 14 Mar 2023 16:37:59 -0300 Subject: [PATCH 08/17] fix nullpointer. --- .../ext/hibernate/diff/ChangedColumnChangeGenerator.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java b/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java index 83280233..5e0afea9 100644 --- a/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java +++ b/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java @@ -44,9 +44,10 @@ private void handleSizeChange(Column column, ObjectDifferences differences, Diff differences.removeDifference(d.getField()); continue; } - int originalSize = ((DataType) d.getReferenceValue()).getColumnSize(); - int newSize = ((DataType) d.getComparedValue()).getColumnSize(); - if (newSize == originalSize) { + Integer originalSize = ((DataType) d.getReferenceValue()).getColumnSize(); + Integer newSize = ((DataType) d.getComparedValue()).getColumnSize(); + if ((newSize == null && originalSize == null) || + (newSize != null && newSize.equals(originalSize))) { differences.removeDifference(d.getField()); } } From 54f43a0876c7300be8a340bd8620f2761ef636ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Mar 2023 21:56:47 +0000 Subject: [PATCH 09/17] Bump maven-surefire-plugin from 2.22.2 to 3.0.0 Bumps [maven-surefire-plugin](https://github.com/apache/maven-surefire) from 2.22.2 to 3.0.0. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-2.22.2...surefire-3.0.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-surefire-plugin dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 92ad1a00..bd07e3c4 100644 --- a/pom.xml +++ b/pom.xml @@ -211,7 +211,7 @@ maven-surefire-plugin - 2.22.2 + 3.0.0 true plain From 312907fb8a4a3c74152d284333b883fa786daeae Mon Sep 17 00:00:00 2001 From: Daniel Mallorga <75833793+MalloD12@users.noreply.github.com> Date: Fri, 17 Mar 2023 17:13:32 -0300 Subject: [PATCH 10/17] Removing UniqueConstraintSnapshotGenerator to avoid issue of index/constraint recreation. (#468) --- .../UniqueConstraintSnapshotGenerator.java | 124 ------------------ .../liquibase.snapshot.SnapshotGenerator | 1 - 2 files changed, 125 deletions(-) delete mode 100644 src/main/java/liquibase/ext/hibernate/snapshot/UniqueConstraintSnapshotGenerator.java diff --git a/src/main/java/liquibase/ext/hibernate/snapshot/UniqueConstraintSnapshotGenerator.java b/src/main/java/liquibase/ext/hibernate/snapshot/UniqueConstraintSnapshotGenerator.java deleted file mode 100644 index 95e9d205..00000000 --- a/src/main/java/liquibase/ext/hibernate/snapshot/UniqueConstraintSnapshotGenerator.java +++ /dev/null @@ -1,124 +0,0 @@ -package liquibase.ext.hibernate.snapshot; - -import liquibase.Scope; -import liquibase.exception.DatabaseException; -import liquibase.snapshot.DatabaseSnapshot; -import liquibase.snapshot.InvalidExampleException; -import liquibase.structure.DatabaseObject; -import liquibase.structure.core.Column; -import liquibase.structure.core.Index; -import liquibase.structure.core.Table; -import liquibase.structure.core.UniqueConstraint; -import org.hibernate.HibernateException; - -import java.math.BigInteger; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Iterator; - -public class UniqueConstraintSnapshotGenerator extends HibernateSnapshotGenerator { - - public UniqueConstraintSnapshotGenerator() { - super(UniqueConstraint.class, new Class[]{Table.class}); - } - - @Override - protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot snapshot) throws DatabaseException, InvalidExampleException { - return example; - } - - @Override - protected void addTo(DatabaseObject foundObject, DatabaseSnapshot snapshot) throws DatabaseException, InvalidExampleException { - if (!snapshot.getSnapshotControl().shouldInclude(UniqueConstraint.class)) { - return; - } - - if (foundObject instanceof Table) { - Table table = (Table) foundObject; - org.hibernate.mapping.Table hibernateTable = findHibernateTable(table, snapshot); - if (hibernateTable == null) { - return; - } - Iterator uniqueIterator = hibernateTable.getUniqueKeyIterator(); - while (uniqueIterator.hasNext()) { - org.hibernate.mapping.UniqueKey hibernateUnique = (org.hibernate.mapping.UniqueKey) uniqueIterator.next(); - - UniqueConstraint uniqueConstraint = new UniqueConstraint(); - uniqueConstraint.setName(hibernateUnique.getName()); - uniqueConstraint.setRelation(table); - uniqueConstraint.setClustered(false); // No way to set true via Hibernate - Iterator columnIterator = hibernateUnique.getColumnIterator(); - int i = 0; - while (columnIterator.hasNext()) { - org.hibernate.mapping.Column hibernateColumn = (org.hibernate.mapping.Column) columnIterator.next(); - uniqueConstraint.addColumn(i, new Column(hibernateColumn.getName()).setRelation(table)); - i++; - } - - Index index = getBackingIndex(uniqueConstraint, hibernateTable, snapshot); - uniqueConstraint.setBackingIndex(index); - - Scope.getCurrentScope().getLog(getClass()).info("Found unique constraint " + uniqueConstraint.toString()); - table.getUniqueConstraints().add(uniqueConstraint); - } - Iterator columnIterator = hibernateTable.getColumnIterator(); - while (columnIterator.hasNext()) { - org.hibernate.mapping.Column column = (org.hibernate.mapping.Column) columnIterator.next(); - if (column.isUnique()) { - UniqueConstraint uniqueConstraint = new UniqueConstraint(); - uniqueConstraint.setRelation(table); - uniqueConstraint.setClustered(false); // No way to set true via Hibernate - String name = "UC_" + table.getName().toUpperCase() + column.getName().toUpperCase() + "_COL"; - if (name.length() > 64) { - name = name.substring(0, 63); - } - uniqueConstraint.addColumn(0, new Column(column.getName()).setRelation(table)); - uniqueConstraint.setName(name); - Scope.getCurrentScope().getLog(getClass()).info("Found unique constraint " + uniqueConstraint.toString()); - table.getUniqueConstraints().add(uniqueConstraint); - - Index index = getBackingIndex(uniqueConstraint, hibernateTable, snapshot); - uniqueConstraint.setBackingIndex(index); - - } - } - - Iterator ucIter = table.getUniqueConstraints().iterator(); - while (ucIter.hasNext()) { - UniqueConstraint uc = ucIter.next(); - if (uc.getName() == null || uc.getName().isEmpty()) { - String name = table.getName() + uc.getColumnNames(); - name = "UCIDX" + hashedName(name); - uc.setName(name); - } - } - } - } - - private String hashedName(String s) { - try { - MessageDigest md = MessageDigest.getInstance("MD5"); - md.reset(); - md.update(s.getBytes()); - byte[] digest = md.digest(); - BigInteger bigInt = new BigInteger(1, digest); - // By converting to base 35 (full alphanumeric), we guarantee - // that the length of the name will always be smaller than the 30 - // character identifier restriction enforced by a few dialects. - return bigInt.toString(35); - } catch (NoSuchAlgorithmException e) { - throw new HibernateException("Unable to generate a hashed name!", e); - } - } - - protected Index getBackingIndex(UniqueConstraint uniqueConstraint, org.hibernate.mapping.Table hibernateTable, DatabaseSnapshot snapshot) { - Index index = new Index(); - index.setRelation(uniqueConstraint.getRelation()); - index.setColumns(uniqueConstraint.getColumns()); - index.setUnique(true); - index.setName(hibernateTable.getName() + "_IX"); - - return index; - } - -} diff --git a/src/main/resources/META-INF/services/liquibase.snapshot.SnapshotGenerator b/src/main/resources/META-INF/services/liquibase.snapshot.SnapshotGenerator index c71d4fe8..59f2b6f5 100644 --- a/src/main/resources/META-INF/services/liquibase.snapshot.SnapshotGenerator +++ b/src/main/resources/META-INF/services/liquibase.snapshot.SnapshotGenerator @@ -6,5 +6,4 @@ liquibase.ext.hibernate.snapshot.PrimaryKeySnapshotGenerator liquibase.ext.hibernate.snapshot.SchemaSnapshotGenerator liquibase.ext.hibernate.snapshot.SequenceSnapshotGenerator liquibase.ext.hibernate.snapshot.TableSnapshotGenerator -liquibase.ext.hibernate.snapshot.UniqueConstraintSnapshotGenerator liquibase.ext.hibernate.snapshot.ViewSnapshotGenerator From 325415f59b353832d4efe87699f26b7892a81b6f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Mar 2023 10:30:16 -0300 Subject: [PATCH 11/17] Bump spring.version from 6.0.6 to 6.0.7 (#470) Bumps `spring.version` from 6.0.6 to 6.0.7. Updates `spring-test` from 6.0.6 to 6.0.7 - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v6.0.6...v6.0.7) Updates `spring-jdbc` from 6.0.6 to 6.0.7 - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v6.0.6...v6.0.7) Updates `spring-beans` from 6.0.6 to 6.0.7 - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v6.0.6...v6.0.7) Updates `spring-context` from 6.0.6 to 6.0.7 - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v6.0.6...v6.0.7) Updates `spring-orm` from 6.0.6 to 6.0.7 - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v6.0.6...v6.0.7) --- updated-dependencies: - dependency-name: org.springframework:spring-test dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.springframework:spring-jdbc dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.springframework:spring-beans dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.springframework:spring-context dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.springframework:spring-orm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 92ad1a00..e4842e70 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,7 @@ UTF-8 6.1.7.Final - 6.0.6 + 6.0.7 0-SNAPSHOT ${env.GITHUB_TOKEN} From 76151dfe8e813be64cbe9466efb8a7cf75232b7f Mon Sep 17 00:00:00 2001 From: fleboulch <9569081+fleboulch@users.noreply.github.com> Date: Fri, 24 Mar 2023 21:23:29 +0100 Subject: [PATCH 12/17] feat: Make test failing with unique constraints (#455) --- src/test/resources/com/example/pojo/auction/User.hbm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/resources/com/example/pojo/auction/User.hbm.xml b/src/test/resources/com/example/pojo/auction/User.hbm.xml index 0c69d711..1cbe4194 100644 --- a/src/test/resources/com/example/pojo/auction/User.hbm.xml +++ b/src/test/resources/com/example/pojo/auction/User.hbm.xml @@ -19,11 +19,11 @@ - - + Date: Fri, 24 Mar 2023 21:56:50 +0000 Subject: [PATCH 13/17] Bump maven-resources-plugin from 3.3.0 to 3.3.1 Bumps [maven-resources-plugin](https://github.com/apache/maven-resources-plugin) from 3.3.0 to 3.3.1. - [Release notes](https://github.com/apache/maven-resources-plugin/releases) - [Commits](https://github.com/apache/maven-resources-plugin/compare/maven-resources-plugin-3.3.0...maven-resources-plugin-3.3.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-resources-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e4842e70..de2ad740 100644 --- a/pom.xml +++ b/pom.xml @@ -194,7 +194,7 @@ maven-resources-plugin - 3.3.0 + 3.3.1 UTF-8 From cf4437c54e5836883a56ebbb33beef1887fdfe8f Mon Sep 17 00:00:00 2001 From: filipe Date: Fri, 31 Mar 2023 00:02:14 -0300 Subject: [PATCH 14/17] Allows ignoring specific data types. --- .../ext/hibernate/diff/ChangedColumnChangeGenerator.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java b/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java index 5e0afea9..051dc1a8 100644 --- a/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java +++ b/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java @@ -19,6 +19,8 @@ */ public class ChangedColumnChangeGenerator extends liquibase.diff.output.changelog.core.ChangedColumnChangeGenerator { + private static final List TYPES_TO_IGNORE_SIZE = List.of("TIMESTAMP"); + @Override public int getPriority(Class objectType, Database database) { if (Column.class.isAssignableFrom(objectType)) { @@ -37,6 +39,9 @@ protected void handleTypeDifferences(Column column, ObjectDifferences difference } private void handleSizeChange(Column column, ObjectDifferences differences, DiffOutputControl control, List changes, Database referenceDatabase, Database comparisonDatabase) { + if (TYPES_TO_IGNORE_SIZE.stream().anyMatch(s -> s.equalsIgnoreCase(column.getType().getTypeName()))) { + return; + } Difference difference = differences.getDifference("type"); if (difference != null) { for (Difference d : differences.getDifferences()) { From eaf8ca2b311307421400e96b52e9170e8a035746 Mon Sep 17 00:00:00 2001 From: filipe Date: Fri, 31 Mar 2023 00:09:44 -0300 Subject: [PATCH 15/17] Allows ignoring specific data types. --- .../ext/hibernate/diff/ChangedColumnChangeGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java b/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java index 051dc1a8..38960e0e 100644 --- a/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java +++ b/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java @@ -15,7 +15,7 @@ /** * Hibernate and database types tend to look different even though they are not. - * There are enough false positives that it works much better to suppress all column changes based on types. + * The only change that we are handling it size change, and even for this one there are exceptions. */ public class ChangedColumnChangeGenerator extends liquibase.diff.output.changelog.core.ChangedColumnChangeGenerator { From c4c391c5afe78156f2c5a567dac2e99dfcaac6ea Mon Sep 17 00:00:00 2001 From: filipe Date: Fri, 31 Mar 2023 13:53:32 -0300 Subject: [PATCH 16/17] Fix nullpointers ignoring types having null size. --- .../ext/hibernate/diff/ChangedColumnChangeGenerator.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java b/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java index 38960e0e..dffc5f3c 100644 --- a/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java +++ b/src/main/java/liquibase/ext/hibernate/diff/ChangedColumnChangeGenerator.java @@ -51,8 +51,7 @@ private void handleSizeChange(Column column, ObjectDifferences differences, Diff } Integer originalSize = ((DataType) d.getReferenceValue()).getColumnSize(); Integer newSize = ((DataType) d.getComparedValue()).getColumnSize(); - if ((newSize == null && originalSize == null) || - (newSize != null && newSize.equals(originalSize))) { + if (newSize == null || originalSize == null || newSize.equals(originalSize)) { differences.removeDifference(d.getField()); } } From 27afcf38f99c520c6d2d9d599cc36332363e0c6d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 21:57:00 +0000 Subject: [PATCH 17/17] Bump jacoco-maven-plugin from 0.8.8 to 0.8.9 Bumps [jacoco-maven-plugin](https://github.com/jacoco/jacoco) from 0.8.8 to 0.8.9. - [Release notes](https://github.com/jacoco/jacoco/releases) - [Commits](https://github.com/jacoco/jacoco/compare/v0.8.8...v0.8.9) --- updated-dependencies: - dependency-name: org.jacoco:jacoco-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e4842e70..c5d0248d 100644 --- a/pom.xml +++ b/pom.xml @@ -283,7 +283,7 @@ org.jacoco jacoco-maven-plugin - 0.8.8 + 0.8.9