Class ActionsToScriptConverter
java.lang.Object
org.pgcodekeeper.core.model.graph.ActionsToScriptConverter
Converts database action containers into executable SQL script statements.
Processes CREATE, ALTER, and DROP operations in proper dependency order while handling
special cases like data movement, table renaming, and partition tables.
This class is responsible for generating the final SQL migration script from resolved database actions. It handles complex scenarios including:
- Data movement mode with temporary table creation and renaming
- Joinable column alterations that can be combined into single ALTER TABLE statements
- Partition table hierarchies and their dependencies
- Microsoft SQL module refresh operations
- Identity column preservation during data movement
The converter processes actions in dependency order and applies filtering based on user selections and configured object type restrictions.
-
Constructor Summary
ConstructorsConstructorDescriptionActionsToScriptConverter(SQLScript script, Set<ActionContainer> actions, Set<IStatement> toRefresh, IDatabase oldDbFull, IDatabase newDbFull) Creates a new ActionsToScriptConverter with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidfillScript(SQLScript script, Set<ActionContainer> actions, Set<IStatement> toRefresh, IDatabase oldDbFull, IDatabase newDbFull, List<TreeElement> selected) Fills the SQL script with statements based on resolved database actions.
-
Constructor Details
-
ActionsToScriptConverter
public ActionsToScriptConverter(SQLScript script, Set<ActionContainer> actions, Set<IStatement> toRefresh, IDatabase oldDbFull, IDatabase newDbFull) Creates a new ActionsToScriptConverter with the specified parameters. Initializes internal structures for data movement mode if enabled in settings.- Parameters:
script- the SQL script to populate with generated statementsactions- set of resolved action containers representing database changestoRefresh- ordered set of statements requiring refresh operations (in reverse order)oldDbFull- the complete old database schema for reference and data movementnewDbFull- the complete new database schema for reference and data movement
-
-
Method Details
-
fillScript
public static void fillScript(SQLScript script, Set<ActionContainer> actions, Set<IStatement> toRefresh, IDatabase oldDbFull, IDatabase newDbFull, List<TreeElement> selected) Fills the SQL script with statements based on resolved database actions. Creates a new ActionsToScriptConverter instance and processes all actions in right order.- Parameters:
script- the SQL script to populate with generated statementsactions- set of resolved action containers representing database changestoRefresh- set of statements that need refreshing (for Microsoft SQL modules)oldDbFull- the complete old database schema for referencenewDbFull- the complete new database schema for referenceselected- list of user-selected tree elements for filtering actions
-