Skip to content

Commit

Permalink
fix: specific Oracle changes should be loaded onlyu when using Oracle…
Browse files Browse the repository at this point in the history
… database. (#198)
  • Loading branch information
filipelautert authored May 28, 2024
1 parent f817f11 commit 844a38d
Show file tree
Hide file tree
Showing 21 changed files with 60 additions and 44 deletions.
19 changes: 19 additions & 0 deletions src/main/java/liquibase/ext/ora/AbstractOracleChange.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package liquibase.ext.ora;

import liquibase.change.AbstractChange;
import liquibase.database.Database;
import liquibase.database.core.OracleDatabase;

/**
* Base class for Oracle changes.
*/
public abstract class AbstractOracleChange extends AbstractChange {

/**
* Only Oracle is supported for this extension changes
*/
@Override
public boolean supports(Database database) {
return database instanceof OracleDatabase;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package liquibase.ext.ora.adddeferredprimarykey;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.Change;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
Expand All @@ -9,7 +9,7 @@
import liquibase.statement.SqlStatement;

@DatabaseChange(name="addDeferredPrimaryKey", description = "Add deferred primary key", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class AddDeferredPrimaryKeyChange extends AbstractChange {
public class AddDeferredPrimaryKeyChange extends AbstractOracleChange {

private String schemaName;
private String tableName;
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/liquibase/ext/ora/check/CheckAttribute.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package liquibase.ext.ora.check;

import liquibase.change.AbstractChange;
import liquibase.change.ChangeMetaData;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.database.Database;
import liquibase.statement.SqlStatement;
import liquibase.util.StringUtil;

public abstract class CheckAttribute extends AbstractChange {
public abstract class CheckAttribute extends AbstractOracleChange {

private String tableName;
private String tablespace;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/liquibase/ext/ora/comment/CommentOnChange.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package liquibase.ext.ora.comment;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.Change;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
Expand All @@ -9,7 +9,7 @@


@DatabaseChange(name="commentOn", description = "Create or replace a comment on a table or a column", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class CommentOnChange extends AbstractChange {
public class CommentOnChange extends AbstractOracleChange {

private String schemaName;
private String tableName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.text.MessageFormat;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.Change;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
Expand All @@ -11,7 +11,7 @@
import liquibase.statement.SqlStatement;

@DatabaseChange(name = "createSynonym", description = "Create synonym", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class CreateSynonymChange extends AbstractChange {
public class CreateSynonymChange extends AbstractOracleChange {

private Boolean replace;
private Boolean isPublic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package liquibase.ext.ora.creatematerializedview;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.Change;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
Expand All @@ -9,7 +9,7 @@
import liquibase.ext.ora.dropmaterializedview.DropMaterializedViewChange;

@DatabaseChange(name="createMaterializedView", description = "Create materialized view", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class CreateMaterializedViewChange extends AbstractChange {
public class CreateMaterializedViewChange extends AbstractOracleChange {
private String schemaName;
private String viewName;
private String columnAliases;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package liquibase.ext.ora.createtrigger;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.Change;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
Expand All @@ -11,7 +11,7 @@
import liquibase.statement.SqlStatement;

@DatabaseChange(name="createTrigger", description = "Create Trigger", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class CreateTriggerChange extends AbstractChange {
public class CreateTriggerChange extends AbstractOracleChange {
private String tableName;
private String schemaName;
private String tablespace;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package liquibase.ext.ora.disabletrigger;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.Change;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
Expand All @@ -9,7 +9,7 @@
import liquibase.statement.SqlStatement;

@DatabaseChange(name="disableTrigger", description = "Disable Trigger", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class DisableTriggerChange extends AbstractChange {
public class DisableTriggerChange extends AbstractOracleChange {

private String schemaName;
private String triggerName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

import java.text.MessageFormat;

import liquibase.change.AbstractChange;
import liquibase.change.Change;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
import liquibase.database.Database;
import liquibase.ext.ora.dropcheck.DropCheckChange;
import liquibase.statement.SqlStatement;

@DatabaseChange(name = "dropSynonym", description = "Drop synonym", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class DropSynonymChange extends AbstractChange {
public class DropSynonymChange extends AbstractOracleChange {

private Boolean isPublic = false;
private String synonymSchemaName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package liquibase.ext.ora.dropmaterializedview;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
import liquibase.database.Database;
import liquibase.statement.SqlStatement;

@DatabaseChange(name="dropMaterializedView", description = "Drop Materialized View", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class DropMaterializedViewChange extends AbstractChange {
public class DropMaterializedViewChange extends AbstractOracleChange {

private String schemaName;
private String viewName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package liquibase.ext.ora.droptrigger;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
import liquibase.database.Database;
import liquibase.statement.SqlStatement;

@DatabaseChange(name="dropTrigger", description = "Drop trigger", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class DropTriggerChange extends AbstractChange {
public class DropTriggerChange extends AbstractOracleChange {
private String triggerName;
private String schemaName;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package liquibase.ext.ora.enabletrigger;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.Change;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
Expand All @@ -9,7 +9,7 @@
import liquibase.statement.SqlStatement;

@DatabaseChange(name="enableTrigger", description = "Enable Trigger", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class EnableTriggerChange extends AbstractChange {
public class EnableTriggerChange extends AbstractOracleChange {

private String schemaName;
private String triggerName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package liquibase.ext.ora.encapsulateTableWithView;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.Change;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
Expand All @@ -12,7 +12,7 @@
import liquibase.statement.core.RenameTableStatement;

@DatabaseChange(name="encapsulateTableWithView", description = "Encapsulate table with view", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class EncapsulateTableWithViewChange extends AbstractChange {
public class EncapsulateTableWithViewChange extends AbstractOracleChange {

private String schemaName;
private String tableName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package liquibase.ext.ora.grant;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;

public abstract class AbstractObjectPermissionChange extends AbstractChange {
public abstract class AbstractObjectPermissionChange extends AbstractOracleChange {

private String schemaName;
private String objectName;
Expand Down Expand Up @@ -134,4 +134,4 @@ public void setIndex(final Boolean index) {
this.index = index;
}

}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package liquibase.ext.ora.longupdate;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
import liquibase.database.Database;
import liquibase.statement.SqlStatement;

@DatabaseChange(name="longUpdate", description = "Long Update", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class LongUpdateChange extends AbstractChange {
public class LongUpdateChange extends AbstractOracleChange {
private Integer commitInterval;
private Integer sleepSeconds;
private String updateSql;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/liquibase/ext/ora/merge/MergeChange.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.ArrayList;
import java.util.List;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.ChangeMetaData;
import liquibase.change.ChangeWithColumns;
import liquibase.change.ColumnConfig;
Expand All @@ -14,7 +14,7 @@
import liquibase.statement.SqlStatement;

@DatabaseChange(name="merge", description = "Merge", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class MergeChange extends AbstractChange implements ChangeWithColumns<ColumnConfig>{
public class MergeChange extends AbstractOracleChange implements ChangeWithColumns<ColumnConfig>{

private String sourceTableName;
private String sourceSchemaName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package liquibase.ext.ora.refreshmaterializedview;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
import liquibase.database.Database;
import liquibase.statement.SqlStatement;

@DatabaseChange(name="refreshMaterializedView", description = "Refresh Materialized View", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class RefreshMaterializedViewChange extends AbstractChange {
public class RefreshMaterializedViewChange extends AbstractOracleChange {

private String schemaName;
private String viewName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package liquibase.ext.ora.renametrigger;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
import liquibase.database.Database;
import liquibase.statement.SqlStatement;

@DatabaseChange(name="renameTrigger", description = "Rename Trigger", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class RenameTriggerChange extends AbstractChange {
public class RenameTriggerChange extends AbstractOracleChange {

private String schemaName;
private String triggerName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package liquibase.ext.ora.settransaction;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
import liquibase.database.Database;
import liquibase.statement.SqlStatement;

@DatabaseChange(name="setTransaction", description = "Set Transaction", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class SetTransactionChange extends AbstractChange {
public class SetTransactionChange extends AbstractOracleChange {
private String transactionName;
private String rollbackSegment;
private String isolationLevel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package liquibase.ext.ora.splittable;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
import liquibase.changelog.ChangeSet;
import liquibase.database.Database;
import liquibase.statement.SqlStatement;

@DatabaseChange(name="splitTable", description = "Split table", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class SplitTableChange extends AbstractChange {
public class SplitTableChange extends AbstractOracleChange {

private String splitTableName;
private String splitTableSchemaName;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/liquibase/ext/ora/truncate/TruncateChange.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package liquibase.ext.ora.truncate;

import liquibase.change.AbstractChange;
import liquibase.ext.ora.AbstractOracleChange;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
import liquibase.database.Database;
import liquibase.statement.SqlStatement;

@DatabaseChange(name="truncate", description = "Truncate", priority = ChangeMetaData.PRIORITY_DEFAULT + 200)
public class TruncateChange extends AbstractChange {
public class TruncateChange extends AbstractOracleChange {

private String schemaName;
private String tableName;
Expand Down

0 comments on commit 844a38d

Please sign in to comment.