Patch from Zell to quell warnings about mismatched schemas for database-
specific auxiliary columns (specifically Postgres's FTS column).
This commit is contained in:
@@ -590,7 +590,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
|||||||
// if the table exists, see if should attempt automatic schema migration
|
// if the table exists, see if should attempt automatic schema migration
|
||||||
if (_schemaVersion < 0) {
|
if (_schemaVersion < 0) {
|
||||||
// nope, versioning disabled
|
// nope, versioning disabled
|
||||||
verifySchemasMatch(metaData, ctx);
|
verifySchemasMatch(metaData, ctx, builder);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,7 +613,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (currentVersion == _schemaVersion) {
|
if (currentVersion == _schemaVersion) {
|
||||||
verifySchemasMatch(metaData, ctx);
|
verifySchemasMatch(metaData, ctx, builder);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -813,7 +813,8 @@ public class DepotMarshaller<T extends PersistentRecord>
|
|||||||
/**
|
/**
|
||||||
* Checks that there are no database columns for which we no longer have Java fields.
|
* Checks that there are no database columns for which we no longer have Java fields.
|
||||||
*/
|
*/
|
||||||
protected void verifySchemasMatch (TableMetaData meta, PersistenceContext ctx)
|
protected void verifySchemasMatch (
|
||||||
|
TableMetaData meta, PersistenceContext ctx, SQLBuilder builder)
|
||||||
throws PersistenceException
|
throws PersistenceException
|
||||||
{
|
{
|
||||||
for (String fname : _columnFields) {
|
for (String fname : _columnFields) {
|
||||||
@@ -821,6 +822,9 @@ public class DepotMarshaller<T extends PersistentRecord>
|
|||||||
meta.tableColumns.remove(fmarsh.getColumnName());
|
meta.tableColumns.remove(fmarsh.getColumnName());
|
||||||
}
|
}
|
||||||
for (String column : meta.tableColumns) {
|
for (String column : meta.tableColumns) {
|
||||||
|
if (builder.isPrivateColumn(column)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
log.warning(getTableName() + " contains stale column '" + column + "'.");
|
log.warning(getTableName() + " contains stale column '" + column + "'.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,6 +160,13 @@ public class MySQLBuilder
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPrivateColumn (String column)
|
||||||
|
{
|
||||||
|
// The MySQL builder does not yet have any private columns.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BuildVisitor getBuildVisitor ()
|
protected BuildVisitor getBuildVisitor ()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -173,6 +173,13 @@ public class PostgreSQLBuilder
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPrivateColumn (String column)
|
||||||
|
{
|
||||||
|
// filter out any column that we created as part of FTS support
|
||||||
|
return column.startsWith("ftsCol_");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BuildVisitor getBuildVisitor ()
|
protected BuildVisitor getBuildVisitor ()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -179,6 +179,13 @@ public abstract class SQLBuilder
|
|||||||
Connection conn, DepotMarshaller<T> marshaller, FullTextIndex fts)
|
Connection conn, DepotMarshaller<T> marshaller, FullTextIndex fts)
|
||||||
throws SQLException;
|
throws SQLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the supplied column is an internal consideration of this {@link SQLBuilder},
|
||||||
|
* e.g. PostgreSQL's full text search data is stored in a table column that should otherwise
|
||||||
|
* not be visible to Depot; this method helps mask it.
|
||||||
|
*/
|
||||||
|
public abstract boolean isPrivateColumn (String column);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden by subclasses to create a dialect-specific {@link BuildVisitor}.
|
* Overridden by subclasses to create a dialect-specific {@link BuildVisitor}.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user