NAME

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

VERSION

version 0.900007

DESCRIPTION

Represents a unique constraint diff operation: ALTER TABLE ... ADD CONSTRAINT UNIQUE (...) or ALTER TABLE ... DROP CONSTRAINT. The constraints of a brand-new table are added the same way, after every CREATE TABLE and before the foreign keys (a foreign key may reference one). Constraints of a table that is dropped go with the table.

Constraints are compared by the columns they cover, in order, not by name: the name the server gives a constraint without one (u <tabid>_<n>, written u136_41) differs from one database to the next. The name serves to drop a constraint, and is written on an add unless the server assigned it. A changed constraint is its old form dropped and the new one added.

ALTER TABLE t ADD CONSTRAINT UNIQUE (a, b) CONSTRAINT name;
ALTER TABLE t DROP CONSTRAINT name;

ATTRIBUTES

replaced

True for the drop of a unique constraint that comes back in the same diff as an add of the same table and the same name (a changed one): the first half of a change, not destructive (core ADR 0080, "destructive_operations" in DBIO::Diff::Base). A constraint that disappears, or one the server named itself, is destructive.

METHODS

diff

my @ops = DBIO::Informix::Diff::UniqueConstraint->diff(
    $source_uniques, $target_uniques, $source_tables, $target_tables,
);

dropped_keys

my $dropped = DBIO::Informix::Diff::UniqueConstraint->dropped_keys(@ops);

A hash reference naming the constraints the operations drop, each as the table and the sorted column names joined by NUL, the form "diff" in DBIO::Informix::Diff::ForeignKey reads to find the keys over them.

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.