A nested space inside a Location — a floor, room, zone, etc.
Spaces form a filesystem-like tree per Location: each row belongs to exactly one Location (required FK) and may optionally belong to a parent Space (self-ref FK), forming arbitrary-depth nesting.
Translatable fields
name and description are translatable. Primary-language values
stay in the dedicated columns; secondary languages live under a
language-code key in data, e.g.:
%{ "es-ES" => %{ "name" => "Planta 2" } }Top-level keys in data carry attachment pointers
(files_folder_uuid, featured_image_uuid), mirroring how
phoenix_kit_locations.data is used.
Kind
kind is a fixed string from @kinds. The DB CHECK constraint in
V122 mirrors the same list — keep both in sync if a new label is
added.
Summary
Types
@type t() :: %PhoenixKitLocations.Schemas.Space{ __meta__: term(), children: term(), data: term(), description: term(), inserted_at: term(), kind: term(), location: term(), location_uuid: term(), name: term(), notes: term(), parent: term(), parent_uuid: term(), position: term(), status: term(), updated_at: term(), uuid: term() }
Functions
Form-facing changeset.
Note: the "child belongs to the same Location as its parent"
guarantee is enforced in the PhoenixKitLocations.Spaces context,
not here — the schema doesn't have parent context to compare
against without an extra DB read. Keep that invariant load-bearing
on the context.