Record Class MigrationContext

java.lang.Object
java.lang.Record
com.onec.migration.MigrationContext

public record MigrationContext(org.jdbi.v3.core.Handle handle, MetadataRegistry registry, SqlDialect dialect) extends Record
Everything an AppMigration gets to work with: a JDBI Handle bound to the transaction the migration (and its history record) runs in, the metadata registry for resolving table/column names from entity metadata, and the active SQL dialect.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MigrationContext(org.jdbi.v3.core.Handle handle, MetadataRegistry registry, SqlDialect dialect)
    Creates an instance of a MigrationContext record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the dialect record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    void
    Convenience shortcut for handle().execute(sql).
    org.jdbi.v3.core.Handle
    Returns the value of the handle record component.
    final int
    Returns a hash code value for this object.
    Returns the value of the registry record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MigrationContext

      public MigrationContext(org.jdbi.v3.core.Handle handle, MetadataRegistry registry, SqlDialect dialect)
      Creates an instance of a MigrationContext record class.
      Parameters:
      handle - the value for the handle record component
      registry - the value for the registry record component
      dialect - the value for the dialect record component
  • Method Details

    • execute

      public void execute(String sql)
      Convenience shortcut for handle().execute(sql).
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • handle

      public org.jdbi.v3.core.Handle handle()
      Returns the value of the handle record component.
      Returns:
      the value of the handle record component
    • registry

      public MetadataRegistry registry()
      Returns the value of the registry record component.
      Returns:
      the value of the registry record component
    • dialect

      public SqlDialect dialect()
      Returns the value of the dialect record component.
      Returns:
      the value of the dialect record component