package migrations
- Alphabetic
- By Inheritance
- migrations
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
type
Migration[T] = (T) ⇒ T
A Migration[T] is a simple type alias for a function that takes a T and produces another T, usually the input value transformed in some way in order to make it compatible with a higher version.
-
implicit final
class
MigrationWithComposition[T] extends AnyVal
Adds support for combining two instances of Migration[T] into a new Migration[T] that will apply the first one and then the second one.
-
class
Migrator[R, V <: Version] extends AnyRef
A
Migrator[R, V]
can migrate raw values of type R from older versions to versionV
by applying a specificMigration[R]
to it.A
Migrator[R, V]
can migrate raw values of type R from older versions to versionV
by applying a specificMigration[R]
to it.You can create instances of
Migrator[R, V]
by using a small type-safe DSL consisting of two parts: thefrom[R, V1]
function will create aMigrator[R, V1]
and then you can use theto[V](migration: Migration[R])
function to build instances that can migrate multiple versions.- R
The type of raw data being migrated. In the JSON implementation this would be
JsValue
.- V
The "current" version of this Migrator, i.e. it can migrate values from V1 to this version or any version in between.
Using the json implementation:
val p = persister[CartCreated, V3]("cart-created", from[JsValue, V1] .to[V2](_.update('cart / 'items / * / 'price ! set[Int](1000))) .to[V3](_.update('timestamp ! set[Long](System.currentTimeMillis - 3600000L))) )
Example: -
case class
UndefinedMigrationException(fromVersion: Int, toVersion: Int) extends RuntimeException with Product with Serializable
Runtime exception for signalling that the specified migration path is not supported.
Value Members
-
def
from[T, V <: V1](implicit arg0: VersionInfo[V]): Migrator[T, V]
Creates a Migrator[T, V1] that can function as a builder for creating Migrator[T, V2], etc.
Creates a Migrator[T, V1] that can function as a builder for creating Migrator[T, V2], etc. Its migration will be the identity function so calling its migrate function will not have any effect.
-
def
identityMigration[T]: Migration[T]
The identity Migration will always return its input as its output.