SchemaUpdater

public final class SchemaUpdater<Model> : SchemaBuilder where Model : Model, Model.Database : SchemaSupporting

Updates schemas, capable of deleting fields.

  • Deletes a custom constraint.

    Declaration

    Swift

    public func deleteConstraint(_ constraint: Model.Database.SchemaConstraint)
  • Deletes a reference constraint from one field to another.

    builder.deleteReference(from: \.userID, to: \User.id)
    

    Declaration

    Swift

    public func deleteReference<T, U, Other>(from: KeyPath<Model, T>, to: KeyPath<Other, U>) where Other : Model

    Parameters

    from

    KeyPath to the local field.

    to

    KeyPath to the foreign field.

  • Removes a UNIQUE constraint from a field.

    builder.deleteUnique(from: \.email)
    

    Declaration

    Swift

    public func deleteUnique<T>(from key: KeyPath<Model, T>)

    Parameters

    keyPath

    KeyPath to the unique field.

  • Removes a UNIQUE constraint from two fields.

    builder.deleteUnique(from: \.email, \.username)
    

    Declaration

    Swift

    public func deleteUnique<T, U>(from a: KeyPath<Model, T>, _ b: KeyPath<Model, U>)

    Parameters

    a

    KeyPath to the first unique field.

    b

    KeyPath to the second unique field.