generateUpdateScript
public static void generateUpdateScript(DatabaseSchema expectedSchema,
DatabaseSchema finalSchema,
DatabaseSchema realSchema,
AbstractSQLGenerator generator,
SQLBatch batch,
SchemaUpdateHints updateHints,
ScriptGenerationConfiguration configuration)
Script generation core. There are multiple possible use-case scenarios: - all schemas are null - this option is forbidden, - final
schema is null and exactly one expected or real schema is given - dropping full structure given in expected or real schema, - final
schema is null and both expected and real schemas are given - dropping structures from real schema that are also included in expected
schema, - final schema is given and both expected and real schema are null - creating all structures given in final schema, - final
schema is given and only expected schema is given - updating structures from expected to final schema (all operations included), -
final schema is given and only real schema is given - updating structures from real to final schema (extra tables, columns and
sequences from real schema are not dropped), - all schemas are given - updating structures from real to final schema (extra tables,
columns and sequences from real schema are dropped only if they are also included in expected schema)
- Parameters:
expectedSchema
- previous schema of database - previous valid version
finalSchema
- target schema of database - target valid version
realSchema
- real version of database - extra structures (not included in expected schema if given) are considered as user
modifications and left as were
generator
- dialect of database
batch
- store for generated sql operations
updateHints
- hints for database updation or other non-structure operations (like inserts, updatse or deletions)