zio.blocks.schema.migration

Members list

Type members

Classlikes

object Changeset

Attributes

Source
MigrationBuilder.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Changeset.type
final case class DynamicMigration(actions: Chunk[MigrationAction])

A pure, serializable migration that operates on DynamicValue. This is the untyped core of the migration system, containing a sequence of MigrationActions that are applied in order.

A pure, serializable migration that operates on DynamicValue. This is the untyped core of the migration system, containing a sequence of MigrationActions that are applied in order.

DynamicMigration is fully serializable because:

  • It contains no closures or functions
  • All transformations are represented as DynamicSchemaExpr
  • All paths are represented as data (DynamicOptic)

This enables migrations to be:

  • Stored in registries
  • Transmitted over the network
  • Applied dynamically
  • Inspected and transformed
  • Used to generate SQL DDL, upgraders, etc.

Attributes

Companion
object
Source
DynamicMigration.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Source
DynamicMigration.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class Migration[A, B](sourceSchema: Schema[A], targetSchema: Schema[B], dynamicMigration: DynamicMigration)

A typed migration that transforms values from type A to type B.

A typed migration that transforms values from type A to type B.

Migration[A, B] provides a type-safe wrapper around DynamicMigration, handling the conversion between typed values and DynamicValue automatically.

The migration process:

  1. Convert input A to DynamicValue using sourceSchema
  2. Apply the dynamicMigration to transform the dynamic value
  3. Convert the result back to B using targetSchema

The schemas can be any Schema[A] and Schema[B], including:

  • Regular schemas derived from case classes/enums
  • Structural schemas (JVM only) for compile-time-only types

This allows migrations between current runtime types and past structural versions without requiring old case classes to exist at runtime.

Type parameters

A

The source type

B

The target type

Value parameters

dynamicMigration

The underlying untyped migration

sourceSchema

Schema for the source type (can be structural or regular)

targetSchema

Schema for the target type (can be structural or regular)

Attributes

Companion
object
Source
Migration.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Source
Migration.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Show all
Self type
Migration.type
sealed trait MigrationAction

Represents a single migration action that operates at a specific path. All actions are fully serializable (no closures or functions) and support structural reversal.

Represents a single migration action that operates at a specific path. All actions are fully serializable (no closures or functions) and support structural reversal.

Attributes

Companion
object
Source
MigrationAction.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Source
MigrationAction.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Attributes

Companion
class
Source
MigrationBuilder.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final class MigrationBuilder[A, B, Changeset](val sourceSchema: Schema[A], val targetSchema: Schema[B], val actions: Chunk[MigrationAction])

Attributes

Companion
object
Source
MigrationBuilder.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Source
MigrationBuilderMacros.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Source
MigrationCompanionVersionSpecific.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Migration

Attributes

Companion
trait
Source
MigrationBuilder.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait MigrationComplete[-A, -B, -Changeset]

Attributes

Companion
object
Source
MigrationBuilder.scala
Supertypes
class Object
trait Matchable
class Any
transparent trait MigrationSelectorSyntax

Scala 3 extension methods for selector syntax in migrations. These are compile-time-only placeholders that get transformed by the macros.

Scala 3 extension methods for selector syntax in migrations. These are compile-time-only placeholders that get transformed by the macros.

Provides syntax sugar for selector expressions like:

  • _.field.each for collection traversal
  • _.variant.when[Type] for case selection
  • _.wrapper.wrapped[Inner] for wrapper unwrapping
  • _.seq.at(0) for index access
  • _.map.atKey(key) for map key access

Attributes

Companion
object
Source
MigrationSelectorSyntax.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Source
MigrationSelectorSyntax.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Source
MigrationValidationMacros.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Scala 3 macros for converting selector expressions into DynamicOptic paths.

Scala 3 macros for converting selector expressions into DynamicOptic paths.

These macros parse selector expressions like:

  • _.field → DynamicOptic.root.field("field")
  • _.a.b.c → DynamicOptic.root.field("a").field("b").field("c")
  • _.items.each → DynamicOptic.root.field("items").elements
  • _.country.when[UK] → DynamicOptic.root.field("country").caseOf("UK")

Attributes

Source
SelectorMacros.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Extensions

Inherited extensions

extension [A](a: A)
inline def when[B <: A]: B

Attributes

Inherited from:
MigrationSelectorSyntax
Source
MigrationSelectorSyntax.scala
inline def wrapped[B]: B

Attributes

Inherited from:
MigrationSelectorSyntax
Source
MigrationSelectorSyntax.scala
extension [C[_], A](c: C[A])
inline def at(index: Int): A

Attributes

Inherited from:
MigrationSelectorSyntax
Source
MigrationSelectorSyntax.scala
inline def each: A

Attributes

Inherited from:
MigrationSelectorSyntax
Source
MigrationSelectorSyntax.scala
extension [M[_, _], K, V](m: M[K, V])
inline def atKey(key: K): V

Attributes

Inherited from:
MigrationSelectorSyntax
Source
MigrationSelectorSyntax.scala
inline def eachKey: K

Attributes

Inherited from:
MigrationSelectorSyntax
Source
MigrationSelectorSyntax.scala
inline def eachValue: V

Attributes

Inherited from:
MigrationSelectorSyntax
Source
MigrationSelectorSyntax.scala