NAME

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

VERSION

version 0.900000

DESCRIPTION

Represents a table-level diff operation: CREATE TABLE ... (with full column definitions for new tables) or DROP TABLE CASCADE. Instances are produced by "diff" and consumed by DBIO::PostgreSQL::Diff.

Diff::Column handles column ADDs for existing tables only; new tables get their full column list inlined in the CREATE TABLE statement produced here.

ATTRIBUTES

schema_name

PostgreSQL schema containing the table.

table_name

The table name.

table_info

Hashref of table metadata from introspection (kind, rls_enabled, etc.).

columns

ArrayRef of column hashrefs for new tables (populated when action is create), so that as_sql can emit a complete CREATE TABLE with all column definitions rather than an empty shell.

METHODS

diff

my @ops = DBIO::PostgreSQL::Diff::Table->diff($source, $target, $source_cols, $target_cols);

Compares two table hashrefs (keyed by schema.table) and returns operations for tables present only in target (create) or only in source (drop). For new tables, passes column metadata so as_sql can emit a complete CREATE TABLE with full column definitions (types, nullability, defaults, identity). Diff::Column only handles ALTER for existing tables.

qualified_name

my $fqn = $op->qualified_name;  # 'auth.users'

Returns the schema-qualified table name.

as_sql

Returns the SQL for this operation. For create, emits a complete CREATE TABLE with all column definitions inline (type, nullability, default, identity). Diff::Column handles column ADDs for existing tables.

summary

Returns a one-line description such as +table: auth.users.

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.