NAME

DBIO::SQLite::Introspect::Indexes - Introspect SQLite indexes

VERSION

version 0.900007

DESCRIPTION

Fetches index metadata via PRAGMA index_list() and PRAGMA index_info(), plus the original CREATE INDEX statement from sqlite_master for partial / expression indexes. Auto-generated indexes (origin u / pk) are kept in the model with their origin; DBIO::SQLite::Diff::Index skips them when diffing.

METHODS

fetch

my $indexes = DBIO::SQLite::Introspect::Indexes->fetch($dbh, $tables);

Returns a hashref keyed by table name. Each value is a hashref keyed by index name. Each index entry has: index_name, is_unique, columns (arrayref), sql (CREATE statement, may be undef for auto-generated UNIQUE indexes), origin (c=CREATE, u=UNIQUE, pk=PRIMARY KEY), partial (1 if WHERE clause present -- the keyword, as "sql_tokens" in DBIO::SQLite::Util reads the statement; a quoted name "where" is not one).

A table and an index are named to the PRAGMAs through "quote_identifier" in DBIO::SQLite::Util, so a name that holds a double quote is read like any other.

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.