NAME
DBIO::MSSQL::Introspect::Indexes - Introspect MSSQL indexes
VERSION
version 0.900004
DESCRIPTION
Fetches index metadata via sys.indexes and sys.index_columns. The index of a primary key is left out (it is the table's key, read with the columns). The index behind a unique constraint is kept and flagged is_unique_constraint: the diff has to add and drop it as a constraint (ALTER TABLE ... ADD/DROP CONSTRAINT), which DROP INDEX cannot (Msg 3723), and tell it from a unique index.
METHODS
fetch
my $indexes = DBIO::MSSQL::Introspect::Indexes->fetch($dbh, $schema, $tables);
Given the tables hashref from DBIO::MSSQL::Introspect::Tables, returns a hashref keyed by table name. Each value is a hashref of index hashrefs keyed by index name with keys: index_name, columns (arrayref), is_unique, is_unique_constraint, kind (clustered, nonclustered, etc) and filter: the predicate of a filtered index (sys.indexes.filter_definition, read where has_filter is set), undef for an index without one. The server returns the predicate in a form of its own (WHERE a = 1 comes back as ([a]=(1))); it is kept as it is, and "normalize_filter" in DBIO::MSSQL::Diff::Index makes two forms comparable.
AUTHOR
DBIO & DBIx::Class Authors
COPYRIGHT AND LICENSE
Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.