# `PhoenixKitOG.Schemas.Assignment`
[🔗](https://github.com/BeamLabEU/phoenix_kit_og/blob/0.4.0/lib/phoenix_kit_og/schemas/assignment.ex#L1)

Binds a template to a scope inside a consumer module's hierarchy.

`module_key` is the consumer's `PhoenixKit.Module.module_key/0`
(e.g. `"publishing"`). `scope_type` is the consumer-defined tier
(`"default"`, `"group"`, `"post"`). `scope_uuid` is the row uuid at
that tier, or `nil` for the module-wide `"default"` tier.

Uniqueness is enforced at the DB level via a partial index pair:

    (module_key, scope_type) WHERE scope_uuid IS NULL
    (module_key, scope_type, scope_uuid) WHERE scope_uuid IS NOT NULL

(See core migration V154.)

# `t`

```elixir
@type t() :: %PhoenixKitOG.Schemas.Assignment{
  __meta__: term(),
  inserted_at: DateTime.t() | nil,
  module_key: String.t() | nil,
  scope_type: String.t() | nil,
  scope_uuid: binary() | nil,
  slot_mapping: map(),
  template:
    PhoenixKitOG.Schemas.Template.t() | Ecto.Association.NotLoaded.t() | nil,
  template_uuid: binary() | nil,
  updated_at: DateTime.t() | nil,
  uuid: binary() | nil
}
```

# `column_widths`

```elixir
@spec column_widths() :: %{required(atom()) =&gt; pos_integer()}
```

`character varying` column widths for `phoenix_kit_og_assignments`, keyed
by field name.

The single source of truth `PhoenixKitOG.Migrations`' V1 DDL
interpolates, so the migration chain and core's `ExpectedSchema` manifest
can never independently disagree on a number.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
