Native PostgreSQL Schema Script: postgres.sql - Organization
This page documents schema objects parsed from config/sql/native/postgres.sql.
Region: Organization
Organization objects, parent organization references, and organization hierarchy closure support.
Tables
m_org
Stores organization objects and hierarchy-related organization attributes.
Represents OrgType, see https://docs.evolveum.com/midpoint/architecture/archive/data-model/midpoint-common-schema/orgtype/
XSD type: http://midpoint.evolveum.com/xml/ns/public/common/common-3#OrgType
Inherits from: m_abstract_role
Columns
| Column | Type | Required / constraints | Description |
|---|---|---|---|
|
|
primary key, required |
Organization object identifier. |
|
|
||
|
|
Display ordering value used when presenting organizations. |
|
|
|
Marks whether this organization represents a tenant. |
Indexes
| Name | Columns | Purpose / notes |
|---|---|---|
|
|
Speeds up lookup by original object name. Used for: original name searches |
|
|
Enforces unique normalized object names and speeds up exact name lookup. Used for: normalized name lookup and uniqueness checks. unique |
|
|
Speeds up ordering or filtering organizations by display order. Used for: organization display ordering |
|
|
Speeds up filtering by object subtype. Used for: subtype filters |
|
|
Speeds up lookup by abstract role identifier. Used for: identifier searches |
|
|
Speeds up filtering by activation validity start time. Used for: validity interval filters |
|
|
Speeds up filtering by activation validity end time. Used for: validity interval filters |
|
|
Speeds up full-text-like object searches. Used for: full-text-like object searches |
|
|
Speeds up filtering or ordering by creation time. Used for: creation time filters and ordering |
|
|
Speeds up filtering or ordering by modification time. Used for: modification time filters and ordering |
Foreign keys
| Column | References |
|---|---|
|
m_ref_object_parent_org
Stores parent organization references that define the organization hierarchy.
Inherits from: m_reference
Columns
| Column | Type | Required / constraints | Description |
|---|---|---|---|
|
|
primary key, required |
OID of the object that owns the parent organization reference. |
|
|
Indexes
| Name | Columns | Purpose / notes |
|---|---|---|
|
|
Speeds up reverse lookup of parent organization references by target organization and relation. Used for: organization hierarchy parent and child searches |
Foreign keys
| Column | References | Notes |
|---|---|---|
|
ON DELETE CASCADE |
Views
Views present derived or queryable data from repository tables.
m_org_closure
Materialized transitive closure of organization parent-child relationships.
Trigger on m_ref_object_parent_org marks this view for refresh in one m_global_metadata row. Closure contains also identity (org = org) entries because:
-
It’s easier to do optimized matrix-multiplication based refresh with them later.
-
It actually makes some query easier and requires AND instead of OR conditions.
-
While the table shows that o ⇒ o (⇒ means "is parent of"), this is not the semantics of isParent/ChildOf searches and they never return parameter OID as a result.
Kind: materialized view
Functions and procedures
Functions and procedures implement repository-side database behavior.
mark_org_closure_for_refresh
Marks organization closure data for refresh when parent organization references change.
Kind: function
mark_org_closure_for_refresh_org
Marks organization closure data for refresh when organization rows are inserted or deleted.
Kind: function
m_refresh_org_closure
Refreshes the organization closure materialized view when a refresh is needed or explicitly forced.
Kind: procedure
Triggers
Triggers run routines automatically when table rows are inserted, updated, or deleted.