NAME
DBIO::Sybase::Diff - Compare two introspected Sybase ASE models
VERSION
version 0.900007
DESCRIPTION
DBIO::Sybase::Diff compares two introspected Sybase ASE database models (as produced by DBIO::Sybase::Introspect) and produces a list of structured diff operations that can be rendered to SQL or a human-readable summary.
my $diff = DBIO::Sybase::Diff->new(
source => $current_model,
target => $desired_model,
);
if ($diff->has_changes) {
print $diff->as_sql;
print $diff->summary;
}
Diff operations are generated in dependency order: foreign-key drops first (so a referenced table/column can then be dropped), then the drops of removed and changed views (a view must be gone before the table under it changes; see DBIO::Sybase::Diff::View), then tables, then primary-key and index drops (ASE refuses to drop a column while an index still references it), then columns, then primary-key adds and index creates/alters (a new or changed column must exist before a key or an index can name it), then foreign-key adds (so the tables/columns -- and keys -- they reference already exist), and the creates of new and changed views last (so the tables and columns they read exist). The primary key is compared as an ordered column list, see "THE PRIMARY KEY IS PART OF THE TABLE" in DBIO::Sybase::Diff::Table.
EVERY STATEMENT ENDS IN ;
Each op's as_sql terminates every statement it renders with ; -- also the second statement of a two-statement op (an index alter's DROP/CREATE, a column alter's MODIFY followed by its REPLACE). That is the only boundary the apply path knows: DBIO::Diff::Base joins the ops with a newline, and DBIO::Deploy::Base::_execute_ddl splits the result on ; and nothing else before handing each piece to $dbh->do. An unterminated op is glued to the next one, and the run reaches ASE as one batch. ASE compiles a batch before executing any of it, so a correctly ordered migration fails whole -- live on ASE 16.0 SP02 a DROP INDEX followed by the ALTER TABLE ... DROP of the indexed column was refused with Msg 4939, because the drop of the index had not run when the column drop was compiled.
The split is not quote-aware. DBIO::SQL::Util::_split_statements (core) knows PostgreSQL $$ quoting and nothing else, so a ; inside a single-quoted string -- a literal default such as 'a;b' -- is split as if it ended the statement, and both halves are rejected. There is no way to escape it from here; a literal default containing ; cannot be applied through DBIO::Sybase::Deploy until core's splitter honours '...'.
SEE ALSO
DBIO::Sybase::Deploy - orchestrates introspection and diff
DBIO::Sybase::Introspect - produces the models being compared
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.