NAME

DBIO::DB2::Diff::Table - Diff operations for DB2 tables

VERSION

version 0.900007

DESCRIPTION

Represents a table-level diff operation in DB2: CREATE TABLE or DROP TABLE. create ops capture the target columns and foreign keys so as_sql can emit the full inline definition in a single statement.

The columns of a create op are read out of the catalog of the compare schema by "fetch" in DBIO::DB2::Introspect::Columns, and as_sql renders the internal catalog fields (ADR 0013), not the normalized ones and not the shape of a result class:

  • catalog_type is TYPENAME and catalog_size the catalog's length. DBIO::DB2::Type leaves it out for the types Db2 declares without one (INTEGER, not INTEGER(4)).

  • catalog_default is the SQL text of the default and is written as it is. _db2_default_literal, which DBIO::DB2::DDL uses on the value of a result class, would quote it a second time.

  • A column with is_auto_increment gets the identity clause "install_ddl" in DBIO::DB2::DDL writes. The model does not carry the identity's own attributes, so it is always START WITH 1, INCREMENT BY 1.

new, the action accessor and summary_prefix come from DBIO::Diff::Op.

METHODS

diff

my @ops = DBIO::DB2::Diff::Table->diff(
    $source_tables, $target_tables,
    $target_columns, $target_fks, $target_unique_constraints,
);

The optional last argument is the unique_constraints section of the target model ({ $table => [ [ $name, \@columns ], ... ] }); a create op renders them inline, the clause "install_ddl" in DBIO::DB2::DDL writes.

Entries of kind view are left out on both sides: DBIO::DB2::Diff::View creates and drops them (ADR 0011).

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.