palio.connectors.schema
Class AutomaticScriptGenerator

java.lang.Object
  extended by palio.connectors.schema.AutomaticScriptGenerator

public class AutomaticScriptGenerator
extends java.lang.Object

Author:
Szymon Kuklewicz

Field Summary
static boolean PUT_FOREIGN_KEYS_AT_END
           
static boolean PUT_INDEXES_AT_END
           
 
Constructor Summary
AutomaticScriptGenerator()
           
 
Method Summary
static void generateCreateScript(DatabaseSchema schemaToCreate, AbstractSQLGenerator generator, SQLBatch batch, SchemaUpdateHints updateHints, ScriptGenerationConfiguration configuration)
           
static void generateUpdateScript(DatabaseSchema expectedSchema, DatabaseSchema finalSchema, DatabaseSchema realSchema, AbstractSQLGenerator generator, SQLBatch batch, SchemaUpdateHints updateHints, ScriptGenerationConfiguration configuration)
          Script generation core.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PUT_INDEXES_AT_END

public static final boolean PUT_INDEXES_AT_END
See Also:
Constant Field Values

PUT_FOREIGN_KEYS_AT_END

public static final boolean PUT_FOREIGN_KEYS_AT_END
See Also:
Constant Field Values
Constructor Detail

AutomaticScriptGenerator

public AutomaticScriptGenerator()
Method Detail

generateCreateScript

public static void generateCreateScript(DatabaseSchema schemaToCreate,
                                        AbstractSQLGenerator generator,
                                        SQLBatch batch,
                                        SchemaUpdateHints updateHints,
                                        ScriptGenerationConfiguration configuration)

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)