Class SqlMigrationExecutor
- java.lang.Object
-
- migratedb.v1.core.internal.resolver.sql.SqlMigrationExecutor
-
- All Implemented Interfaces:
MigrationExecutor
public class SqlMigrationExecutor extends Object implements MigrationExecutor
Database migration based on a sql file.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanExecuteInTransaction()Whether the execution can take place inside a transaction.voidexecute(Context context)Executes the migration this executor is associated with.booleanshouldExecute()Whether the migration associated with this executor should be executed or not.StringtoString()
-
-
-
Method Detail
-
execute
public void execute(Context context) throws SQLException
Description copied from interface:MigrationExecutorExecutes the migration this executor is associated with.- Specified by:
executein interfaceMigrationExecutor- Parameters:
context- The context to use to execute the migration against the DB.- Throws:
SQLException- when the execution of a statement failed.
-
canExecuteInTransaction
public boolean canExecuteInTransaction()
Description copied from interface:MigrationExecutorWhether the execution can take place inside a transaction. Almost all implementation should returntrue. This however makes it possible to execute certain migrations outside a transaction. This is useful for databases like PostgreSQL and SQL Server where certain statement can only execute outside a transaction.- Specified by:
canExecuteInTransactionin interfaceMigrationExecutor- Returns:
trueif a transaction should be used (highly recommended), orfalseif not.
-
shouldExecute
public boolean shouldExecute()
Description copied from interface:MigrationExecutorWhether the migration associated with this executor should be executed or not.- Specified by:
shouldExecutein interfaceMigrationExecutor- Returns:
trueif the migration should be executed, orfalseif not.
-
-