Class SchemaReport
java.lang.Object
com.codename1.orm.session.SchemaReport
What Session.schemaReport() found when it compared the registered mappings
with the tables that already exist. Reading it changes nothing in the
database.
Every difference is one of three kinds, because they call for different fixes:
SchemaReport.Kind.MIGRATION_REQUIRED: the mapping is fine, the schema is behind it -- a table or column is missing. A migration brings the database to the mapping.SchemaReport.Kind.UNSUPPORTED: the existing column cannot hold what the mapping would write, or a key the mapping does not know identifies the rows. Data would be misread or refused, so the mapping has to change -- a different storage type,@Temporalfor a native timestamp, an explicit@Columnname -- or the column has to be converted deliberately.SchemaReport.Kind.CONSTRAINT_MISMATCH: a column's nullability differs from the mapping. Rows still read and write, but the database accepts a null the mapping cannot hold, or refuses one it can. A schema that is deliberately stricter than the mapping is legitimate, which is why this is kept apart.
SchemaReport report = session.schemaReport();
for (SchemaReport.Issue issue : report.getIssues()) {
Log.p(issue.getKind() + " " + issue.getTable() + "." + issue.getColumn()
+ ": " + issue.getMessage());
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOne difference between a mapping and the existing schema.static enumHow anSchemaReport.Issueis resolved. -
Constructor Summary
ConstructorsConstructorDescriptionSchemaReport(List<SchemaReport.Issue> issues) Creates a report holdingissues, in the order they were found. -
Method Summary
Modifier and TypeMethodDescriptionEvery difference found, unmodifiable.getIssues(SchemaReport.Kind kind) The differences of one kind.booleanTrue when the existing schema matches every mapping.toString()A multi-line summary: unsupported mappings first, then required migrations, then constraint differences.
-
Constructor Details
-
SchemaReport
Creates a report holdingissues, in the order they were found.- Parameters:
issues- the differences found; copied
-
-
Method Details
-
isCompatible
public boolean isCompatible()True when the existing schema matches every mapping. -
getIssues
Every difference found, unmodifiable. -
getIssues
The differences of one kind.- Parameters:
kind- the kind to select- Returns:
- the matching issues, in the order they were found
-
toString
-