PhoenixKitManufacturing. Schemas. MachineOperation
(PhoenixKitManufacturing v0.3.2)
Copy Markdown
View Source
Join table for the many-to-many between machines and operations.
Carries an optional per-machine time_norm_seconds override — nil
means "use the linked operation's base_time_norm_seconds"; see
PhoenixKitManufacturing.Machines.list_machine_operations/1.
operation_uuid is a soft reference into phoenix_kit_entities
(EntityData.uuid for the operation entity), not an
Ecto.Schema.belongs_to/3 association — operation data lives in a
separate package with no FK to point at (see
PhoenixKitManufacturing.EntitiesRegistry). machine stays a normal
association since Machine remains a schema of this module.
Summary
Functions
Builds an insert changeset for a machine ↔ operation link.
Types
Functions
@spec changeset(t(), map()) :: Ecto.Changeset.t()
Builds an insert changeset for a machine ↔ operation link.
Casts the two FK columns, the optional time_norm_seconds override, and
timestamps; wires assoc_constraint/2 on the machine association so an
FK violation comes back as a clean {:error, changeset} instead of
raising Ecto.ConstraintError. operation_uuid is a soft reference (see
moduledoc) — there is no Postgres FK left to violate, so no
assoc_constraint/2 for it.