Skip to content

v1.18.0

Choose a tag to compare

@gmpassos gmpassos released this 12 Oct 21:27
· 259 commits to master since this release
f41e26f
  • @EntityIndex: indexes over one or more fields (composite indexes),
    declared on the entity class, which @EntityField.indexed() (one field)
    can't express:
    @EnableReflection()
    @EntityIndex(['establishment', 'creationDate'])
    class OrderClosing extends Entity { ... }
    • Default name: <table>__<column1>_<column2>__idx; or name:. A default
      name past the dialect's identifier limit (SQLDialect.maxIdentifierLength:
      PostgreSQL 63, MySQL 64) is shortened with a stable hash
      (<prefix>_<hash>__idx); a too long name: is an ArgumentError.
    • Generated with the table (generateCreateTableSQL /
      generateFullCreateTableSQLs, generateTables). An @EntityIndex over
      the same columns as another index of the table (e.g. a single field also
      indexed or a reference) isn't created twice; the same name over other
      columns is an ArgumentError.
    • checkTables: an existing table without an index over these columns (in
      this order, any name) is reported (missingEntityIndexes), with its
      CREATE INDEX SQL. The columns are the table's ones mapped to the fields,
      as for the other checks (e.g. a legacy creationDate column). If its name
      is in use (drop it first: IF NOT EXISTS would skip it), that's reported
      too: by an index over other columns, an index not usable as it, or
      another table's index or relation (PostgreSQL, SQLite: names unique per
      schema; DBSQLAdapter.findIndexesNamesInUse).
    • An unknown, hidden or collection (relationship) field is an
      ArgumentError.
    • EntityHandler.getEntityIndexes(): the class annotations
      (ClassReflectionEntityHandler), or GenericEntityHandler(entityIndexes:).
  • CreateIndexSQL.columns: an index over several columns (columns,
    isComposite); SQLGenerator.resolveEntityIndexColumns /
    generateEntityIndexesSQLs.
  • TableScheme.indexes (by name, its key columns in order) and hasIndexOn:
    introspected by the PostgreSQL (pg_index: the table visible in the search
    path, also partitioned tables), MySQL (SHOW INDEX) and SQLite
    (pragma_index_list/pragma_index_info) adapters; null when unknown
    (memory). Only usable plain-column indexes: partial, expression/functional,
    (MySQL) prefix and (PostgreSQL) invalid indexes are ignored, and INCLUDE
    columns aren't key columns. PostgreSQL before 11 (no indnkeyatts) is
    supported; indexes that can't be read are null, not a scheme error.
  • DBSQLAdapter.checkDBTables({force}): checks again on demand (e.g. after a
    migration), reading all the loaded table schemes (also referenced and
    relationship tables), fields types and references again
    (SchemeProvider.disposeTablesSchemesCaches; the adapters' references
    cache too). checkedTables is false until a forced check passes.