NAME

DBIO::DB2::Diff::UniqueConstraint - Diff operations for DB2 unique constraints

VERSION

version 0.900007

DESCRIPTION

Represents a unique constraint diff operation: ADD CONSTRAINT ... UNIQUE or DROP UNIQUE. The constraints of a brand-new table are created inline by DBIO::DB2::Diff::Table; this module handles tables that exist in both models. Built on DBIO::Diff::Op.

Identity is by constraint name. Db2 has no ALTER for the columns of a constraint, so a change becomes a drop-then-add pair (drop first). The index Db2 keeps behind a constraint goes with DROP UNIQUE and comes with ADD CONSTRAINT; DBIO::DB2::Introspect::Indexes does not report it, so DBIO::DB2::Diff::Index never sees it (ADR 0009).

METHODS

diff

my @ops = DBIO::DB2::Diff::UniqueConstraint->diff(
    $source_ucs, $target_ucs, $source_tables, $target_tables,
);

The two sections are the unique_constraints of the models, { $table => [ [ $name, \@columns ], ... ] }; either may be undef (a model older than the section). A table in both models but without an entry in one section is a table without constraints there.

as_sql

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.