}
}
for (Iterator indexItr = m_schema.getIndexIterator(); indexItr.hasNext();)
{
Index index = (Index)indexItr.next();
if (m_final.findIndex(index.getName()) == null)
{
eh = addException(eh, new MetadataException("err.meta.upgrade.sql.extraIndex",
new Object[]{index.getName(), index.getTable().getName(), m_final.getDataSource().getName()}));
}
}
for (Iterator indexItrFinal = m_final.getIndexIterator(); indexItrFinal.hasNext();)
{
Index indexFinal = (Index)indexItrFinal.next();
Index index = m_schema.findIndex(indexFinal.getName());
if (index == null)
{
if (indexFinal.getType() >= Index.BTREE)
{
eh = addException(eh, new MetadataException("err.meta.upgrade.sql.missingIndex",
new Object[]{indexFinal.getName(), indexFinal.getTable().getName(), m_final.getDataSource().getName()}));
}
}
else
{
if (!indexFinal.getTable().getName().equals(index.getTable().getName()))
{
eh = addException(eh, new MetadataException("err.meta.upgrade.sql.indexTableMismatch",
new Object[]{indexFinal.getTable().getName(), index.getTable().getName(),
indexFinal.getName(), m_final.getDataSource().getName()}));
}
if (indexFinal.getType() != index.getType())
{
eh = addException(eh, new MetadataException("err.meta.upgrade.sql.indexTypeMismatch",
new Object[]{indexFinal.getTypeString(), index.getTypeString(), indexFinal.getName(),
indexFinal.getTable().getName(), m_final.getDataSource().getName()}));
}
if (indexFinal.isUnique() != index.isUnique())
{
eh = addException(eh, new MetadataException("err.meta.upgrade.sql.indexUniquenessMismatch",
new Object[]{Boolean.valueOf(indexFinal.isUnique()), Boolean.valueOf(index.isUnique()),
indexFinal.getName(), indexFinal.getTable().getName(), m_final.getDataSource().getName()}));
}
if (indexFinal.getFill() != index.getFill())
{
eh = addException(eh, new MetadataException("err.meta.upgrade.sql.indexFillMismatch",
new Object[]{Primitive.createInteger(indexFinal.getFill()), Primitive.createInteger(index.getFill()),
indexFinal.getName(), indexFinal.getTable().getName(), m_final.getDataSource().getName()}));
}
String sRelatedTableFinal = (indexFinal.getRelatedTable() == null) ? "" : indexFinal.getRelatedTable().getName();
String sRelatedTable = (index.getRelatedTable() == null) ? "" : index.getRelatedTable().getName();
if (!sRelatedTableFinal.equals(sRelatedTable))
{
eh = addException(eh, new MetadataException("err.meta.upgrade.sql.indexRelatedTableMismatch",
new Object[]{sRelatedTableFinal, sRelatedTable, indexFinal.getName(),
indexFinal.getTable().getName(), m_final.getDataSource().getName()}));
}
for (int i = 0, n = index.getAspectCount(); i < n; ++i)
{
Aspect aspect = m_final.findIndex(index.getAspect(i).getName());
if (aspect != null && !indexFinal.hasAspect(aspect))
{
eh = addException(eh, new MetadataException("err.meta.upgrade.sql.extraIndexAspect",
new Object[]{aspect.getName(), indexFinal.getName(), indexFinal.getTable().getName(),
m_final.getDataSource().getName()}));
}
}
for (int i = 0, n = indexFinal.getAspectCount(); i < n; ++i)
{
Aspect aspect = m_schema.findIndex(indexFinal.getAspect(i).getName());
if (aspect != null && !index.hasAspect(aspect))
{
eh = addException(eh, new MetadataException("err.meta.upgrade.sql.missingIndexAspect",
new Object[]{aspect.getName(), indexFinal.getName(), indexFinal.getTable().getName(),
m_final.getDataSource().getName()}));
}
}
if (index.getType() != Index.VIRTUAL && index.getType() != Index.QUERY)
{
for (int i = 0, n = index.getIndexColumnCount(); i < n; ++i)
{
IndexColumn indexColumn = index.getIndexColumn(i);
if (indexFinal.findIndexColumn(indexColumn.getColumn().getName()) == null)
{
eh = addException(eh, new MetadataException("err.meta.upgrade.sql.extraIndexColumn",
new Object[]{indexColumn.getColumn().getName(), index.getName(),
index.getTable().getName(), m_final.getDataSource().getName()}));
}
}
for (int i = 0, n = indexFinal.getIndexColumnCount(); i < n; ++i)
{
IndexColumn indexColumnFinal = indexFinal.getIndexColumn(i);
IndexColumn indexColumn = index.findIndexColumn(indexColumnFinal.getColumn().getName());
if (indexColumn == null)
{
eh = addException(eh, new MetadataException("err.meta.upgrade.sql.missingIndexColumn",
new Object[]{indexColumnFinal.getColumn().getName(), indexFinal.getName(),