PhoenixKitManufacturing.Schemas.MachineTypeAssignment (PhoenixKitManufacturing v0.2.0)

Copy Markdown View Source

Join table for the many-to-many between machines and machine types.

Summary

Functions

Builds an insert changeset for a machine ↔ type assignment.

Types

t()

@type t() :: %PhoenixKitManufacturing.Schemas.MachineTypeAssignment{
  __meta__: term(),
  inserted_at: term(),
  machine: term(),
  machine_type: term(),
  machine_type_uuid: term(),
  machine_uuid: term(),
  updated_at: term(),
  uuid: term()
}

Functions

changeset(assignment, attrs)

@spec changeset(t(), map()) :: Ecto.Changeset.t()

Builds an insert changeset for a machine ↔ type assignment.

Casts the two FK columns + timestamps and wires assoc_constraint/2 on both associations so an FK violation comes back as a clean {:error, changeset} instead of raising Ecto.ConstraintError.