Report a better error message if a bogus rename is attempted. Some formatting
cleanup. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2362 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -101,9 +101,15 @@ public abstract class EntityMigration extends Modifier
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) {
|
@Override
|
||||||
|
protected void init (String tableName, Map<String, FieldMarshaller<?>> marshallers) {
|
||||||
super.init(tableName, marshallers);
|
super.init(tableName, marshallers);
|
||||||
_newColumnDef = marshallers.get(_newColumnName).getColumnDefinition();
|
FieldMarshaller<?> fm = marshallers.get(_newColumnName);
|
||||||
|
if (fm == null) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
_tableName + " does not contain '" + _newColumnName + "' field.");
|
||||||
|
}
|
||||||
|
_newColumnDef = fm.getColumnDefinition();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String _oldColumnName, _newColumnName;
|
protected String _oldColumnName, _newColumnName;
|
||||||
@@ -133,7 +139,8 @@ public abstract class EntityMigration extends Modifier
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) {
|
@Override
|
||||||
|
protected void init (String tableName, Map<String, FieldMarshaller<?>> marshallers) {
|
||||||
super.init(tableName, marshallers);
|
super.init(tableName, marshallers);
|
||||||
_columnName = marshallers.get(_fieldName).getColumnName();
|
_columnName = marshallers.get(_fieldName).getColumnName();
|
||||||
_newColumnDef = marshallers.get(_fieldName).getColumnDefinition();
|
_newColumnDef = marshallers.get(_fieldName).getColumnDefinition();
|
||||||
@@ -174,7 +181,7 @@ public abstract class EntityMigration extends Modifier
|
|||||||
* migration has been determined to be runnable so one cannot rely on this method having been
|
* migration has been determined to be runnable so one cannot rely on this method having been
|
||||||
* called in {@link #shouldRunMigration}.
|
* called in {@link #shouldRunMigration}.
|
||||||
*/
|
*/
|
||||||
protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers)
|
protected void init (String tableName, Map<String, FieldMarshaller<?>> marshallers)
|
||||||
{
|
{
|
||||||
_tableName = tableName;
|
_tableName = tableName;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user