diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java index d7e82dc5281..23487f65048 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java @@ -31,11 +31,7 @@ public class FlywayMigration implements JavaMigration { @Override public String getDescription() { - String retval = myTask.getDescription(); - if (retval == null) { - retval = myTask.getClass().getSimpleName() + " " + getVersion(); - } - return retval; + return myTask.getDescription(); } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTask.java index 20f505260e6..94ea306adcd 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTask.java @@ -41,6 +41,12 @@ public class AddColumnTask extends BaseTableColumnTypeTask { super(theRelease, theVersion); } + @Override + public void validate() { + super.validate(); + setDescription("Add column " + getColumnName() + " on table " + getTableName()); + } + @Override public void execute() throws SQLException { Set columnNames = JdbcUtils.getColumnNames(getConnectionProperties(), getTableName()); diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddForeignKeyTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddForeignKeyTask.java index 603c262cd17..35c372438da 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddForeignKeyTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddForeignKeyTask.java @@ -62,6 +62,7 @@ public class AddForeignKeyTask extends BaseTableColumnTask { Validate.isTrue(isNotBlank(myConstraintName)); Validate.isTrue(isNotBlank(myForeignTableName)); Validate.isTrue(isNotBlank(myForeignColumnName)); + setDescription("Add foreign key " + myConstraintName + " from column " + getColumnName() + " of table " + getTableName() + " to column " + myForeignColumnName + " of table " + myForeignTableName); } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIdGeneratorTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIdGeneratorTask.java index 20947df94fc..b3a658c0e35 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIdGeneratorTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIdGeneratorTask.java @@ -46,6 +46,7 @@ public class AddIdGeneratorTask extends BaseTask { @Override public void validate() { Validate.notBlank(myGeneratorName); + setDescription("Add id generator " + myGeneratorName); } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTask.java index 572e878bb6c..2a008107d2a 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTask.java @@ -63,6 +63,7 @@ public class AddIndexTask extends BaseTableTask { Validate.notBlank(myIndexName, "Index name not specified"); Validate.isTrue(myColumns.size() > 0, "Columns not specified for AddIndexTask " + myIndexName + " on table " + getTableName()); Validate.notNull(myUnique, "Uniqueness not specified"); + setDescription("Add " + myIndexName + " index to table " + getTableName()); } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableByColumnTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableByColumnTask.java index 0901aa0e22f..4a2d911e90c 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableByColumnTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableByColumnTask.java @@ -42,6 +42,12 @@ public class AddTableByColumnTask extends BaseTableTask { super(theRelease, theVersion); } + @Override + public void validate() { + super.validate(); + setDescription("Add table " + getTableName()); + } + public void addAddColumnTask(AddColumnTask theTask) { Validate.notNull(theTask); myAddColumnTasks.add(theTask); diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableRawSqlTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableRawSqlTask.java index ef2a76a91b0..aa506534bd6 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableRawSqlTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableRawSqlTask.java @@ -43,6 +43,12 @@ public class AddTableRawSqlTask extends BaseTableTask { super(theRelease, theVersion); } + @Override + public void validate() { + super.validate(); + setDescription("Add table using raw sql"); + } + public void addSql(DriverTypeEnum theDriverType, @Language("SQL") String theSql) { Validate.notNull(theDriverType); Validate.notBlank(theSql); diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java index 64ecdab89a5..108d35e6960 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java @@ -120,6 +120,7 @@ public class ArbitrarySqlTask extends BaseTask { mySql = theSql; myMode = theMode; myConsumer = theConsumer; + setDescription("Execute raw sql"); } diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java index bf2294c5b47..0a6283c9e80 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java @@ -72,6 +72,9 @@ public abstract class BaseTask { } public String getDescription() { + if (myDescription == null) { + return this.getClass().getSimpleName(); + } return myDescription; } diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTask.java index 9619056eeca..939a479f336 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTask.java @@ -54,6 +54,7 @@ public class CalculateHashesTask extends BaseTableColumnTask { super(theRelease, theVersion); } + @Override + public void validate() { + super.validate(); + setDescription("Drop column " + getColumnName() + " from table " + getTableName()); + } + @Override public void execute() throws SQLException { Set columnNames = JdbcUtils.getColumnNames(getConnectionProperties(), getTableName()); diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTask.java index 36ae6ccaae3..90f221e52a6 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTask.java @@ -60,6 +60,8 @@ public class DropForeignKeyTask extends BaseTableTask { Validate.isTrue(isNotBlank(myConstraintName)); Validate.isTrue(isNotBlank(myParentTableName)); + setDescription("Drop foreign key " + myConstraintName + " from table " + getTableName()); + } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIdGeneratorTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIdGeneratorTask.java index c8188e3f16f..0650997dbc3 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIdGeneratorTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIdGeneratorTask.java @@ -46,6 +46,7 @@ public class DropIdGeneratorTask extends BaseTask { @Override public void validate() { Validate.notBlank(myGeneratorName); + setDescription("Drop id generator " + myGeneratorName); } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTask.java index cf1f80e609c..303129fe66b 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTask.java @@ -49,9 +49,7 @@ public class DropIndexTask extends BaseTableTask { super.validate(); Validate.notBlank(myIndexName, "The index name must not be blank"); - if (getDescription() == null) { - setDescription("Drop index " + myIndexName + " on table " + getTableName()); - } + setDescription("Drop index " + myIndexName + " from table " + getTableName()); } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropTableTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropTableTask.java index 1bfbf4dceb2..ef2e14a8e6b 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropTableTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropTableTask.java @@ -37,6 +37,12 @@ public class DropTableTask extends BaseTableTask { super(theRelease, theVersion); } + @Override + public void validate() { + super.validate(); + setDescription("Drop table " + getTableName()); + } + @Override public void execute() throws SQLException { Set tableNames = JdbcUtils.getTableNames(getConnectionProperties()); diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ExecuteRawSqlTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ExecuteRawSqlTask.java index f0cce4be291..efe0dbdf230 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ExecuteRawSqlTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ExecuteRawSqlTask.java @@ -41,6 +41,7 @@ public class ExecuteRawSqlTask extends BaseTask { public ExecuteRawSqlTask(String theRelease, String theVersion) { super(theRelease, theVersion); + setDescription("Execute raw sql"); } public ExecuteRawSqlTask addSql(DriverTypeEnum theDriverType, @Language("SQL") String theSql) { diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/InitializeSchemaTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/InitializeSchemaTask.java index 21cebbb3bac..704edb28783 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/InitializeSchemaTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/InitializeSchemaTask.java @@ -19,6 +19,7 @@ public class InitializeSchemaTask extends BaseTask { public InitializeSchemaTask(String theRelease, String theVersion, ISchemaInitializationProvider theSchemaInitializationProvider) { super(theRelease, theVersion); mySchemaInitializationProvider = theSchemaInitializationProvider; + setDescription("Initialize schema"); } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ModifyColumnTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ModifyColumnTask.java index be20c30b97c..8551e3ccb35 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ModifyColumnTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ModifyColumnTask.java @@ -41,6 +41,12 @@ public class ModifyColumnTask extends BaseTableColumnTypeTask super(theRelease, theVersion); } + @Override + public void validate() { + super.validate(); + setDescription("Modify column " + getColumnName() + " on table " + getTableName()); + } + @Override public void execute() throws SQLException { diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/RenameColumnTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/RenameColumnTask.java index b02cf0b5dcb..73452980d7c 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/RenameColumnTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/RenameColumnTask.java @@ -48,6 +48,12 @@ public class RenameColumnTask extends BaseTableTask { myDeleteTargetColumnFirstIfBothExist = theDeleteTargetColumnFirstIfBothExist; } + @Override + public void validate() { + super.validate(); + setDescription("Rename column " + myOldName + " to " + myNewName + " on table " + getTableName()); + } + public void setOldName(String theOldName) { Validate.notBlank(theOldName); myOldName = theOldName;