Member Junction
    Preparing search index...

    This class has methods that can check various aspects of a MemberJunction installation's integrity. Code Gen will run the various integrity checks based on configuration options that can be set in the master configuration file.

    Index

    Constructors

    Methods

    • Checks that the base view has no more columns than the entity has fields (MJ #3608).

      The position check in CheckSingleEntity only compares as many columns as there are fields, so a view with extra trailing columns (say a joined name column with no virtual field) passes it. Every write to such an entity fails: spCreate/spUpdate capture the view row into a table variable shaped by the fields, and the column counts differ. Run only after CheckSingleEntity passes.

      Reported as a warning for one release, so databases already in this state can still run CodeGen and the count of affected entities becomes visible; it is planned to become a failure after that.

      Parameters

      • fields: EntityFieldSequenceRow[]
      • catalog: Map<string, string[]>
      • excludedViewFields: { bare: Set<string>; qualified: Set<string> }

      Returns string

      an empty string when the widths match, otherwise the warning text

    • Checks every in-scope entity on its own, so one failing entity does not hide the next one (#4737). For each entity the EntityField sequences must run 1..N with no duplicates, and the fields must line up with the base view's columns as the database catalog reports them. The catalog is read instead of a sample row so a view with no rows is still checked.

      Scope follows the run's schema configuration: excludeSchemas is skipped, and when includeSchemas is set only those schemas are checked.

      Parameters

      Returns Promise<IntegrityCheckResult>

    • Checks one entity's fields (already ordered by Sequence).

      Parameters

      • fields: EntityFieldSequenceRow[]
      • catalog: Map<string, string[]>
      • excludedViewFields: { bare: Set<string>; qualified: Set<string> }

      Returns string

      an empty string when the entity passes, otherwise the failure text

    • An entity's fields that are expected in its base view: all of them but the configured exclusions.

      Parameters

      • fields: EntityFieldSequenceRow[]
      • excludedViewFields: { bare: Set<string>; qualified: Set<string> }

      Returns EntityFieldSequenceRow[]

    • Base-view column exclusions (baseViewExcludedFields) keep an EntityField whose column the view leaves out on purpose, so those fields are skipped in the column comparison. Entries are Entity.Field or a bare Field (any entity). Empty unless exclusions are permitted.

      Returns { bare: Set<string>; qualified: Set<string> }

    • True when the schema is checked: not in excludeSchemas, and in includeSchemas when that list is set. Compared case-insensitively.

      Parameters

      • schemaName: string | null | undefined

      Returns boolean

    • Reads the column order of every view and table in the given schemas from INFORMATION_SCHEMA.COLUMNS, which both SQL Server and PostgreSQL provide.

      Parameters

      Returns Promise<Map<string, string[]>>

      schema.object (lower case) → column names in ordinal order