NAME
DBIO::Sybase::Diff::ForeignKey - Diff Sybase ASE foreign keys
VERSION
version 0.900000
DESCRIPTION
Compares two foreign-key sets and generates FK-level diff operations for tables that exist on both sides. FKs on a brand-new table are the table's own concern; FKs on a dropped table vanish with it. This module only reconciles FK changes on tables retained across the diff.
The introspected per-constraint FK shape (produced by "_group_fks_by_constraint" in DBIO::Sybase::Introspect) is { constraint_name, from_columns, to_table, to_columns, on_update, on_delete }. FK identity here is the relationship tuple from_columns -> to_table(to_columns) (not the name, since the desired/target model built from a schema definition has no live name); the alterable attributes are on_update / on_delete.
DROP (and the drop-half of an alter) prefers the real, server-assigned constraint_name carried on the source (live/introspected) entry, so a foreign key created out-of-band under any name is dropped by its actual name. CREATE (and the create-half of an alter) targets the desired model, which has no live name, so it falls back to a deterministic generated name derived from the relationship tuple (fk_<table>_<cols>, the same approach the DDL emitter uses for unnamed unique indexes). When the source entry also lacks a name, DROP falls back to the same generated name.
Sybase ASE cannot alter an FK constraint in place, so an attribute change becomes a drop-then-add pair.
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.