NAME

DBIO::SQLite::Diff::Index - Diff operations for SQLite indexes

VERSION

version 0.900001

DESCRIPTION

Represents an index-level diff operation: CREATE INDEX or DROP INDEX. SQLite has no ALTER INDEX, so changed definitions become a drop-then-create pair.

Auto-generated indexes (origin u for UNIQUE constraints, pk for primary keys) are skipped -- they belong to the table itself, not to explicit CREATE INDEX statements.

METHODS

diff

my @ops = DBIO::SQLite::Diff::Index->diff(
  $source, $target, $source_tables, $target_tables);

$source and $target are the indexes sub-models from DBIO::SQLite::Introspect: { $table_name => { $idx_name => $info } }.

The optional $source_tables / $target_tables hashrefs are the tables sections of the two models (threaded in by DBIO::SQLite::Diff). They are used to detect tables that are being dropped in this same diff pass: SQLite's DROP TABLE automatically removes that table's own indexes, so emitting a later standalone DROP INDEX for one of them would fail with no such index and abort the deploy (karr #14). When these arguments are absent (e.g. direct unit-test calls) the dropped set is empty and no drops are suppressed, preserving the original two-argument behaviour.

as_sql

Returns CREATE INDEX (preferring the original sql from sqlite_master if available) or DROP INDEX.

summary

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.