NAME
DBIO::MSSQL::Diff::ForeignKey - Diff operations for MSSQL foreign keys
VERSION
version 0.900007
DESCRIPTION
Represents a foreign key diff operation: ADD CONSTRAINT or DROP CONSTRAINT. All of them are standalone statements: a brand-new table is created without its foreign keys by DBIO::MSSQL::Diff::Table and gets them here, and a table that is dropped gets its foreign keys dropped here so that tables referencing each other can go (DBIO::MSSQL::Diff orders the phases). Built on DBIO::Diff::Op.
A table that has foreign keys on one side only is compared against none on the other: the walk of the core visits the tables of the target, so a table whose last foreign key was removed would otherwise never be visited and the constraint would stay.
FK identity is by constraint_name. MSSQL has no ALTER for a foreign key, so a definition change becomes a drop-then-add pair. Local and remote column lists are order-significant, so they are compared as dim fields.
METHODS
diff
my @ops = DBIO::MSSQL::Diff::ForeignKey->diff(
$source_fks, $target_fks, $source_tables, $target_tables,
);
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.