# SchemaHistory

    public final class SchemaHistory : ExpressibleByArrayLiteral

    extension SchemaHistory: CustomDebugStringConvertible, CoreStoreDebugStringConvertible

The `SchemaHistory` encapsulates multiple `DynamicSchema` across multiple model versions. It contains all model history and is used by the `DataStack` to

- `currentModelVersion`

  The version string for the current model version. The `DataStack` will try to migrate all `StorageInterface`s added to itself to this version, following the version steps provided by the `migrationChain`.

  #### Declaration

  Swift

      public let currentModelVersion: ModelVersion

- `currentSchema`

  The schema for the current model version. The `DataStack` will try to migrate all `StorageInterface`s added to itself to this version, following the version steps provided by the `migrationChain`.

  #### Declaration

  Swift

      public var currentSchema: DynamicSchema { get }

- `migrationChain`

  The version string for the current model version. The `DataStack` will try to migrate all `StorageInterface`s added to itself to this version, following the version steps provided by the `migrationChain`.

  #### Declaration

  Swift

      public let migrationChain: MigrationChain

- `init(_:migrationChain:)`

  Convenience initializer for a `SchemaHistory` created from a single xcdatamodeld file.

  #### Declaration

  Swift

      public convenience init(_ xcodeDataModeld: (allSchema: [XcodeDataModelSchema], currentModelVersion: ModelVersion), migrationChain: MigrationChain = nil)

  #### Parameters

  `xcodeDataModeld` | a tuple returned from the `XcodeDataModelSchema.from(modelName:bundle:migrationChain:)` method.
  `migrationChain` | the `MigrationChain` that indicates the sequence of model versions to be used as the order for progressive migrations. If not specified, will default to a non-migrating data stack.

- `init(_:_:migrationChain:exactCurrentModelVersion:)`

  Initializes a `SchemaHistory` with a list of `DynamicSchema` and a `MigrationChain` to describe the order of progressive migrations.

  #### Declaration

  Swift

      public convenience init(_ schema: DynamicSchema, _ otherSchema: DynamicSchema..., migrationChain: MigrationChain = nil, exactCurrentModelVersion: String? = nil)

  #### Parameters

  `schema` | a `DynamicSchema` that represents a model version
  `otherSchema` | a list of `DynamicSchema` that represent other model versions
  `migrationChain` | the `MigrationChain` that indicates the sequence of model versions to be used as the order for progressive migrations. If not specified, will default to a non-migrating data stack.
  `exactCurrentModelVersion` | an optional string to explicitly select the current model version string. This is useful if the `DataStack` should load a non-latest model version (usually to prepare data before migration). If not provided, the current model version will be computed from the `MigrationChain`.

- `init(allSchema:migrationChain:exactCurrentModelVersion:)`

  Initializes a `SchemaHistory` with a list of `DynamicSchema` and a `MigrationChain` to describe the order of progressive migrations.

  #### Declaration

  Swift

      public required init(allSchema: [DynamicSchema], migrationChain: MigrationChain = nil, exactCurrentModelVersion: String? = nil)

  #### Parameters

  `allSchema` | a list of `DynamicSchema` that represent model versions
  `migrationChain` | the `MigrationChain` that indicates the sequence of model versions to be used as the order for progressive migrations. If not specified, will default to a non-migrating data stack.
  `exactCurrentModelVersion` | an optional string to explicitly select the current model version string. This is useful if the `DataStack` should load a non-latest model version (usually to prepare data before migration). If not provided, the current model version will be computed from the `MigrationChain`.

### ExpressibleByArrayLiteral

- `init(arrayLiteral:)`

  #### Declaration

  Swift

      public convenience init(arrayLiteral elements: DynamicSchema...)

### CustomDebugStringConvertible

- `debugDescription`

  #### Declaration

  Swift

      public var debugDescription: String { get }