Package com.randomnoun.common.db.history
Class HistoryTableGenerator
java.lang.Object
com.randomnoun.common.db.history.HistoryTableGenerator
This class will generate history table and triggers.
If you get these error messages:
Access denied; you need the SUPER privilege for this operationthen try this:
GRANT ALL PRIVILEGES ON ON schema_name.* TO 'ON schema_name'@'%' WITH GRANT OPTION;I've got a sqlserver version of this somewhere. Good luck finding that again.
This class is similar to the old HistoryTableGenerator, but uses templates instead.
TODO add other db types
TODO add stored procs to roll back table(s) to a given point in time
TODO add history partitions, if mysql supports it
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the SQL that will create history tables, triggers and stored procedures.void
setJessopScript
(String jessopScript) void
setJessopScriptFilename
(String jessopScriptFilename) void
setOptions
(Map<String, Object> options) Set the options for the history generator.void
setSchemaName
(String schemaName)
-
Constructor Details
-
HistoryTableGenerator
-
-
Method Details
-
setOptions
Set the options for the history generator.History options are specific to the generator being used, but typical options are:
- undoEnabledTableNames - List
- dropTables - Boolean
- existingDataUserActionId - Boolean
- alwaysRecreateTriggers - Boolean
- alwaysRecreateStoredProcedures - Boolean
- includeUpdateBitFields - Boolean
- includeCurrentUser - Boolean
Refer to the source code of the generator as to which options are supported ( e.g. src/main/resources/common/db/mysql/mysql-historyTable-2.sql.jessop )
- Parameters:
options
-
- undoEnabledTableNames - List
-
generateHistoryTableSql
Returns the SQL that will create history tables, triggers and stored procedures.To break this String back into individual SQL statements, use
SqlParser
- Returns:
- SQL that will create history tables, triggers and stored procedures
- Throws:
ScriptException
-
getJessopScript
-
setJessopScript
-
getJessopScriptFilename
-
setJessopScriptFilename
-
getSchemaName
-
setSchemaName
-
getOptions
-