NAME
DBIO::Informix::Diff::PrimaryKey - Diff operations for Informix primary keys
VERSION
version 0.900007
DESCRIPTION
Represents a primary key diff operation: ALTER TABLE ... ADD CONSTRAINT PRIMARY KEY (...) or ALTER TABLE ... DROP CONSTRAINT.
The model has no section for primary keys. The key is read from is_pk and pk_position of the columns, as the columns it covers in key order, and the name from primary_key_name of the table in the tables section (the server's u <tabid>_<n> unless the table was created with a named one). A key is compared by its columns in order -- the order is the one a foreign key must reference it in (-297 otherwise) -- and a changed key is its old form dropped and the new one added.
ALTER TABLE t DROP CONSTRAINT u136_41;
ALTER TABLE t ADD CONSTRAINT PRIMARY KEY (a, b);
Informix has no DROP PRIMARY KEY and refuses a second key (-704), so the old key is dropped first, by its name; a key to add is written without one, the server names it. A model without primary_key_name cannot drop a key: as_sql dies, naming the table. Views are skipped, and so are tables on one side only: a new table has its key in its CREATE TABLE, a dropped one takes it along.
ATTRIBUTES
replaced
True for the drop of a primary key that is the first half of a drop + add of the key of that table with other columns: it replaces the key and leaves the table with a key, so it counts as changing, not destructive (core ADR 0080, "destructive_operations" in DBIO::Diff::Base).
METHODS
diff
my @ops = DBIO::Informix::Diff::PrimaryKey->diff(
$source_columns, $target_columns, $source_tables, $target_tables,
);
The drops and the adds in table order; DBIO::Informix::Diff places them among the other operations.
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.