NAME

DBIO::Informix::Diff - Compare two introspected Informix models

VERSION

version 0.900007

DESCRIPTION

DBIO::Informix::Diff compares two introspected Informix models (produced by DBIO::Informix::Introspect) and emits a list of structured diff operations that can be rendered to SQL or a human-readable summary.

my $diff = DBIO::Informix::Diff->new(
    source => $current_model,
    target => $desired_model,
);

if ($diff->has_changes) {
    print $diff->as_sql;
    print $diff->summary;
}

Operations are emitted in an order the server can run: first the drops of foreign keys (DBIO::Informix::Diff::ForeignKey) and indexes (dropping a column or table takes its indexes and constraints along, so a drop behind it fails), then tables, then columns, then the new primary keys and unique constraints, indexes and foreign keys. Views are dropped first and created last.

A foreign key that stays but references a primary key or unique constraint dropped (or changed) in the same diff goes first as well and is added again last: the server takes the key along with the constraint, and a later DROP CONSTRAINT of the key fails with -623. The primary key is compared by the columns the model flags (is_pk, pk_position) in key order, see DBIO::Informix::Diff::PrimaryKey: a changed key is dropped with the unique constraints to drop and added before the unique constraints to add.

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.