integrityCheck Method @beta

Performs integrity checks on this iModel.

The quick check runs the ten checks below other than Missing Child Rows. It reports pass/fail for each check based on the first problem found, without returning problem details. The specific checks return all problem rows. Selecting both quickCheck and specific checks repeats the selected work in both modes.

The checks are:

  • Data Columns Check: Checks for missing nonvirtual physical columns in mapped data tables. It does not compare column types.
  • EC Profile Check: Checks expected EC profile tables, indexes, and iModel triggers for missing or mismatching SQL definitions. It does not check be_* tables.
  • Navigation Class Ids Check: Checks that each non-null persisted RelECClassId is the declared relationship class or one of its derived classes.
  • Navigation Ids Check: Checks that a navigation property's non-null .Id (the referenced instance's ECInstanceId) resolves to a row in the first relationship constraint class in the navigation direction, including derived classes.
  • Linktable Foreign Key Class Ids Check: Checks that SourceECClassId and TargetECClassId have matching meta.ECClassDef entries. This checks class existence only, not endpoint-class validity.
  • Linktable Foreign Key Ids Check: Checks SourceECInstanceId and TargetECInstanceId for null or an unresolved row in the first endpoint constraint class, including derived classes.
  • Class Ids Check: Checks persisted ECClassId values for a corresponding class definition. This checks class existence, not whether the class belongs in that table.
  • Data Schema Check: Checks for missing mapped data tables and indexes. Results report object names and types, not DDL differences.
  • Schema Load Check: Checks whether the schema manager can load each schema recorded in the database. A problem reports the schema name without a reason.
  • Missing Child Rows Check: Checks whether each existing bis_Element row has all required mapped child-table rows.
  • Diverged Property Maps Check: Checks whether an inherited property maps to different columns for a base and derived class under the same physical table root.

If no options are provided, or if quickCheck is false and no specific check is enabled, a quick check is performed by default. The checks are read-only and use the current primary connection. They have no callbacks, and the native operation blocks the backend while each check runs.

integrityCheck(options?: IntegrityCheckOptions): Promise<IntegrityCheckResult[]>

@see ECSQL integrity checks

@returns An array of integrity check results.

@throws IModelError if the iModel is not open.

Parameter Type Description
options IntegrityCheckOptions Options specifying which integrity checks to perform.

Returns - Promise<IntegrityCheckResult[]>

An array of integrity check results.

Defined in

Last Updated: 24 September, 2026