Class RetireLegacyJobExecutionModelMigration

java.lang.Object
db.migration.RetireLegacyJobExecutionModelMigration
All Implemented Interfaces:
org.flywaydb.core.api.migration.JavaMigration

public class RetireLegacyJobExecutionModelMigration extends Object implements org.flywaydb.core.api.migration.JavaMigration
Completes the cutover that V57 began: moves every attempt onto the durable lifecycle statuses and removes the tables and columns the synchronous job engine left behind.

This cannot be plain SQL. The initial schema declared the jobs.status and actions.status checks, the actions(job_id, priority) unique and the jobs.job_result_id unique without naming any of them, and the generated names differ per database. The old status checks have to come off before the values can be rewritten, and PostgreSQL drops a constraint along with its column while H2 refuses, so every one of them has to be resolved from the catalog at runtime.

Version:
3.0.6
Author:
Stephen Prizio
  • Constructor Details

    • RetireLegacyJobExecutionModelMigration

      public RetireLegacyJobExecutionModelMigration()
  • Method Details

    • getVersion

      public org.flywaydb.core.api.MigrationVersion getVersion()
      Returns the Flyway version for this migration.
      Specified by:
      getVersion in interface org.flywaydb.core.api.migration.JavaMigration
    • getDescription

      public String getDescription()
      Returns the Flyway description for this migration.
      Specified by:
      getDescription in interface org.flywaydb.core.api.migration.JavaMigration
    • getChecksum

      public Integer getChecksum()
      Returns the checksum for this migration.
      Specified by:
      getChecksum in interface org.flywaydb.core.api.migration.JavaMigration
    • canExecuteInTransaction

      public boolean canExecuteInTransaction()
      Allows the migration to execute transactionally where the database supports it.
      Specified by:
      canExecuteInTransaction in interface org.flywaydb.core.api.migration.JavaMigration
    • migrate

      public void migrate(org.flywaydb.core.api.migration.Context context) throws Exception
      Rewrites lifecycle statuses and drops the legacy result model.
      Specified by:
      migrate in interface org.flywaydb.core.api.migration.JavaMigration
      Throws:
      Exception