About schema
The schema is Infrahub's data model — a flexible, organization-specific definition of what objects exist in your infrastructure, design, and business logic, what properties they have, and how they relate to each other. It acts as an abstraction layer over the graph database, so no knowledge of database administration is needed for day-to-day use.
Because the schema is stored in the database like any other object, Infrahub supports a different schema per branch. Schema changes go through the same branch-and-propose workflow as data changes, meaning you can test schema evolution in isolation before merging it to the main branch.
Building blocks
A schema is composed of four primary types:
- Node: A concrete object in your infrastructure model, such as a device, interface, or IP address. Nodes have attributes and relationships.
- Attribute: A direct value on a node, such as a name (
Text), an IP address (IPHost), or a flag (Boolean). - Relationship: A typed link between two nodes. Relationships have a cardinality (
oneormany) and a kind that controls how they appear in the UI and behave during deletion. - Generic: A reusable base that shares attributes and relationships across multiple node types. Similar to class inheritance in object-oriented programming.
Video: exploring the Infrahub schema
In this section
- Nodes & attributes — Define nodes, attribute kinds, uniqueness constraints, and human-friendly identifiers
- Relationships — Model connections between nodes, including kinds, direction, and identifiers
- Generics & inheritance — Share structure across node types and control inheritance behavior
- Branch awareness — Control how schema objects behave across branches
- Hierarchy — Organise nodes in trees with ancestor and descendant queries
- Schema extensions — Add attributes and relationships to existing nodes without modifying their definition