Make sure we use the up to date metadata when doing our stale column check.
This commit is contained in:
@@ -641,9 +641,10 @@ public class DepotMarshaller<T extends PersistentRecord>
|
|||||||
if (!metaData.tableExists) {
|
if (!metaData.tableExists) {
|
||||||
// if the table does not exist, create it
|
// if the table does not exist, create it
|
||||||
createTable(ctx, builder, declarations);
|
createTable(ctx, builder, declarations);
|
||||||
|
metaData = TableMetaData.load(ctx, getTableName());
|
||||||
} else {
|
} else {
|
||||||
// if it does exist, run our migrations
|
// if it does exist, run our migrations
|
||||||
runMigrations(ctx, metaData, builder, currentVersion);
|
metaData = runMigrations(ctx, metaData, builder, currentVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for stale columns now that the table is up to date
|
// check for stale columns now that the table is up to date
|
||||||
@@ -720,8 +721,8 @@ public class DepotMarshaller<T extends PersistentRecord>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void runMigrations (PersistenceContext ctx, TableMetaData metaData,
|
protected TableMetaData runMigrations (PersistenceContext ctx, TableMetaData metaData,
|
||||||
final SQLBuilder builder, int currentVersion)
|
final SQLBuilder builder, int currentVersion)
|
||||||
throws DatabaseException
|
throws DatabaseException
|
||||||
{
|
{
|
||||||
log.info("Migrating " + getTableName() + " from " + currentVersion + " to " +
|
log.info("Migrating " + getTableName() + " from " + currentVersion + " to " +
|
||||||
@@ -932,6 +933,8 @@ public class DepotMarshaller<T extends PersistentRecord>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return metaData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// translate an array of field names to an array of column names
|
// translate an array of field names to an array of column names
|
||||||
|
|||||||
Reference in New Issue
Block a user