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 Details

    • execute

      public void execute(Context context) throws SQLException
      Description copied from interface: MigrationExecutor
      Executes the migration this executor is associated with.
      Specified by:
      execute in interface MigrationExecutor
      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: MigrationExecutor
      Whether the execution can take place inside a transaction. Almost all implementation should return true. 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:
      canExecuteInTransaction in interface MigrationExecutor
      Returns:
      true if a transaction should be used (highly recommended), or false if not.
    • shouldExecute

      public boolean shouldExecute()
      Description copied from interface: MigrationExecutor
      Whether the migration associated with this executor should be executed or not.
      Specified by:
      shouldExecute in interface MigrationExecutor
      Returns:
      true if the migration should be executed, or false if not.
    • toString

      public String toString()
      Overrides:
      toString in class Object