Skip to content

Commit

Permalink
chore: invoke deprecated methods in default supports method for backw…
Browse files Browse the repository at this point in the history
…ards compatibility (#5897)

chore: invoke deprecated methods in default supports method to ensure extensions backwards compatibility
  • Loading branch information
filipelautert committed May 10, 2024
1 parent 32b4861 commit 1bf155a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions liquibase-standard/src/main/java/liquibase/database/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@
import liquibase.statement.DatabaseFunction;
import liquibase.statement.SqlStatement;
import liquibase.structure.DatabaseObject;
import liquibase.structure.core.ForeignKey;
import liquibase.structure.core.Index;
import liquibase.structure.core.PrimaryKey;
import liquibase.structure.core.UniqueConstraint;
import liquibase.structure.core.*;
import liquibase.util.StringUtil;

import java.io.IOException;
Expand Down Expand Up @@ -372,6 +369,7 @@ default void addCompleteSqlToScope(String completeSql) {
*
* @deprecated Know if you should quote the name or not, and use {@link #escapeColumnName(String, String, String, String)} which will quote things that look like functions, or leave it along as you see fit. Don't rely on this function guessing.
*/
@Deprecated
String escapeColumnName(String catalogName, String schemaName, String tableName, String columnName, boolean quoteNamesThatMayBeFunctions);

/**
Expand All @@ -392,7 +390,22 @@ default void addCompleteSqlToScope(String completeSql) {
@Deprecated
boolean supportsCatalogs();

/**
* Whether this database supports the specified object type.
* It is invoking the deprecated methods to ensure that extensions are not broken, but
* once those are removed it will return only true
*
* @param object the object type to check
* @return true if the database supports the object type, false otherwise
*/
default boolean supports(Class<? extends DatabaseObject> object) {
if (Sequence.class.isAssignableFrom(object)) {
return supportsSequences();
} else if (Schema.class.isAssignableFrom(object)) {
return supportsSchemas();
} else if (Catalog.class.isAssignableFrom(object)) {
return supportsCatalogs();
}
return true;
}

Expand Down Expand Up @@ -500,6 +513,7 @@ default boolean supports(Class<? extends DatabaseObject> object) {
* removing set schema or catalog names if they are not supported
* @deprecated use {@link liquibase.CatalogAndSchema#standardize(Database)}
*/
@Deprecated
CatalogAndSchema correctSchema(CatalogAndSchema schema);

/**
Expand Down

0 comments on commit 1bf155a

Please sign in to comment.