NAME

DBIO::Firebird::Diff::View - Diff operations for Firebird views

VERSION

version 0.900004

DESCRIPTION

View-level diff operations in Firebird: CREATE VIEW for a view the schema has and the database lacks (create), DROP VIEW for a view only the database has (drop). A view the database has with another definition is dropped (drop, replaced) before the tables are touched and created again (change) after them, so a column the new definition no longer reads can be dropped in the same diff. The definition is rdb$relations.rdb$view_source of the introspected model (the view_source key of the tables section).

Two definitions are the same when they are equal after leading and trailing whitespace is cut and every run of whitespace is one blank. Nothing else is normalised: a different spelling of the same query is a change, and dropping and creating the same query again is harmless.

The diff does not guess what the server will accept. A view other objects depend on, or whose new definition is refused for another reason, fails when the statement runs, with the server's own error; nothing is left out. In particular, an unchanged view that reads a changed view is not dropped with it: the server refuses the DROP VIEW of the changed one, loudly.

METHODS

normalize

my $text = DBIO::Firebird::Diff::View->normalize($view_source);

The comparison form of a definition: whitespace runs collapsed, ends cut.

diff

my %ops = DBIO::Firebird::Diff::View->diff($source_tables, $target_tables);

Returns ( drops => [ ... ], creates => [ ... ] ), two lists of operations. The drops (removed views and changed ones) are to run before the tables are touched, the creates (new views and changed ones, created again) after them. A view that reads another is dropped before and created after it, where its definition names the other by its name. A name that is a table on one side and a view on the other is not handled here ("refusal" in DBIO::Firebird::Diff::Table).

as_sql

DROP VIEW "name"; or CREATE VIEW "name" AS <definition>;

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.