Class SchemaDiffEngine
MigrationPlan that brings the live database in line with the
metadata-derived SchemaModel.
Existence (tables, columns) is diffed against the live database via
INFORMATION_SCHEMA, so it works on day one against any pre-existing deployment.
Type changes are detected by comparing declared types against the previous
SchemaSnapshot — exact string comparison of what the metadata declared last
time, immune to dialect-specific type reporting. Without a stored snapshot (first boot
after upgrading the framework) type changes are invisible; they are picked up once a
baseline snapshot exists.
Renames are recognized through previousNames on @Attribute,
@Catalog and @Document: when the new name is missing from the database
but a former name is present, the plan renames (keeping data) instead of creating fresh.
Anything that can lose data — dropping tables/columns, narrowing a type — is flagged
SchemaChange.destructive() and only executed when explicitly allowed. Drops are
only proposed for objects the framework knows it used to manage (present in the previous
snapshot, or columns of a metadata-managed table); user-created tables are never touched.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondiff(SchemaModel desired, SchemaSnapshot previous, DatabaseIntrospector.DbState db)
-
Constructor Details
-
SchemaDiffEngine
-
-
Method Details
-
diff
public MigrationPlan diff(SchemaModel desired, SchemaSnapshot previous, DatabaseIntrospector.DbState db)
-