indexNameFor function

String indexNameFor(
  1. SchemaTable table,
  2. ColumnMeta c
)

: derive the index name for a ColumnMeta that has isIndexed: true. Same heuristic as EntityMeta.createIndexStatements.

Implementation

String indexNameFor(SchemaTable table, ColumnMeta c) {
  if (c.indexName != null) return c.indexName!;
  final String suffix = c.isUniqueIndex ? 'unq' : 'idx';
  return '${table.name}_${c.sqlName}_$suffix';
}