Package org.flywaydb.core.api
Class MigrationVersion
java.lang.Object
org.flywaydb.core.api.MigrationVersion
- All Implemented Interfaces:
Comparable<MigrationVersion>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final MigrationVersion
Current version.static final MigrationVersion
Version for an empty schema.static final MigrationVersion
Latest version.static final MigrationVersion
Next version. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
static MigrationVersion
fromVersion
(String version) Create a MigrationVersion from a version String.getMajor()
getName()
The raw, unprocessed text to represent the version.int
hashCode()
boolean
Convenience method for quickly checking whether this version is at least as new as this other version.boolean
isMajorNewerThan
(String otherVersion) Convenience method for quickly checking whether this major version is newer than this other major version.boolean
isNewerThan
(String otherVersion) Convenience method for quickly checking whether this version is newer than this other version.toString()
-
Field Details
-
EMPTY
Version for an empty schema. -
LATEST
Latest version. -
CURRENT
Current version. Only a marker. For the real version use Flyway.info().current() instead. -
NEXT
Next version.
-
-
Method Details
-
fromVersion
Create a MigrationVersion from a version String.- Parameters:
version
- The version String. The valuecurrent
will be interpreted as MigrationVersion.CURRENT, a marker for the latest version that has been applied to the database.- Returns:
- The MigrationVersion
-
toString
-
getVersion
- Returns:
- Numeric version as String
-
getName
-
equals
-
hashCode
public int hashCode() -
isAtLeast
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
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
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
- Returns:
- The major version.
-
getMajorAsString
- Returns:
- The major version as a string.
-
getMinorAsString
- Returns:
- The minor version as a string.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<MigrationVersion>
-
getRawVersion
The raw, unprocessed text to represent the version.
-