Package org.flywaydb.core.api

## Class MigrationVersion

- java.lang.Object
- - org.flywaydb.core.api.MigrationVersion

- All Implemented Interfaces:
    `java.lang.Comparable<MigrationVersion>`

      public final class MigrationVersion
      extends java.lang.Object
      implements java.lang.Comparable<MigrationVersion>

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static MigrationVersion` | `CURRENT` | Current version.
    `static MigrationVersion` | `EMPTY` | Version for an empty schema.
    `static MigrationVersion` | `LATEST` | Latest version.
    `static MigrationVersion` | `NEXT` | Next version.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `compareTo​(MigrationVersion o)` |
    `boolean` | `equals​(java.lang.Object o)` |
    `static MigrationVersion` | `fromVersion​(java.lang.String version)` | Create a MigrationVersion from a version String.
    `java.math.BigInteger` | `getMajor()` |
    `java.lang.String` | `getMajorAsString()` |
    `java.lang.String` | `getMinorAsString()` |
    `java.lang.String` | `getName()` |
    `java.lang.String` | `getVersion()` |
    `int` | `hashCode()` |
    `boolean` | `isAtLeast​(java.lang.String otherVersion)` | Convenience method for quickly checking whether this version is at least as new as this other version.
    `boolean` | `isMajorNewerThan​(java.lang.String otherVersion)` | Convenience method for quickly checking whether this major version is newer than this other major version.
    `boolean` | `isNewerThan​(java.lang.String otherVersion)` | Convenience method for quickly checking whether this version is newer than this other version.
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### EMPTY

          public static final MigrationVersion EMPTY

      Version for an empty schema.

    - #### LATEST

          public static final MigrationVersion LATEST

      Latest version.

    - #### CURRENT

          public static final MigrationVersion CURRENT

      Current version. Only a marker. For the real version use Flyway.info().current() instead.

    - #### NEXT

          public static final MigrationVersion NEXT

      Next version.

  - ### Method Detail

    - #### fromVersion

          public static MigrationVersion fromVersion​(java.lang.String version)

      Create a MigrationVersion from a version String.
      Parameters:
        `version` - The version String. The value `current` will be interpreted as MigrationVersion.CURRENT, a marker for the latest version that has been applied to the database.
      Returns:
        The MigrationVersion

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getVersion

          public java.lang.String getVersion()

      Returns:
        Numeric version as String

    - #### getName

          public java.lang.String getName()

    - #### equals

          public boolean equals​(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### isAtLeast

          public boolean isAtLeast​(java.lang.String otherVersion)

      Convenience method for quickly checking whether this version is at least as new as this other version.
      Parameters:
        `otherVersion` - The other version.
      Returns:
        `true` if this version is equal or newer, `false` if it is older.

    - #### isNewerThan

          public boolean isNewerThan​(java.lang.String otherVersion)

      Convenience method for quickly checking whether this version is newer than this other version.
      Parameters:
        `otherVersion` - The other version.
      Returns:
        `true` if this version is newer, `false` if it is not.

    - #### isMajorNewerThan

          public boolean isMajorNewerThan​(java.lang.String otherVersion)

      Convenience method for quickly checking whether this major version is newer than this other major version.
      Parameters:
        `otherVersion` - The other version.
      Returns:
        `true` if this major version is newer, `false` if it is not.

    - #### getMajor

          public java.math.BigInteger getMajor()

      Returns:
        The major version.

    - #### getMajorAsString

          public java.lang.String getMajorAsString()

      Returns:
        The major version as a string.

    - #### getMinorAsString

          public java.lang.String getMinorAsString()

      Returns:
        The minor version as a string.

    - #### compareTo

          public int compareTo​(MigrationVersion o)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<MigrationVersion>`