NAME
DBIO::PostgreSQL::Diff - Compare two introspected PostgreSQL models
VERSION
version 0.900000
DESCRIPTION
DBIO::PostgreSQL::Diff compares two introspected PostgreSQL database models (as produced by DBIO::PostgreSQL::Introspect) and produces a list of structured diff operations. These operations can then be rendered to SQL or a human-readable summary.
my $diff = DBIO::PostgreSQL::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: extensions first, then schemas, types, functions, tables, columns, indexes, triggers, and policies. That same order is used for both summary and as_sql, so review output and executable output stay aligned.
METHODS
register_diff_class
DBIO::PostgreSQL::Diff->register_diff_class(
model_key => 'spatial_refs',
class => 'DBIO::PostgreSQL::PostGIS::Diff::SpatialRef',
position => 'after:indexes',
);
Register a Diff class for a model key. Use position (after:KEY or before:KEY) to control ordering.
target_from_compiled
my $target = DBIO::PostgreSQL::Diff->target_from_compiled($compiled_model);
Translates the neutral model from DBIO::Schema::ModelCompiler into the PostgreSQL introspect-shaped model that diff consumes.
The compiled model uses native_type (as produced by DBIO::PostgreSQL::Adapter). This method translates that into the exact data_type strings that DBIO::PostgreSQL::Introspect::Columns returns (i.e. whatever pg_catalog.format_type reports), keys tables as "public.$table_name", and populates all top-level sections the Diff engine dereferences so that no spurious diffs arise from missing keys.
Auto-increment primary-key columns are mapped to identity = 'a' (GENERATED ALWAYS AS IDENTITY), which is the canonical DBIO convention for integer PKs in PostgreSQL.
DBIO::PostgreSQL::Deploy - orchestrates introspection and diff
DBIO::PostgreSQL::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.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 326:
Unknown directive: =seealso