NAME
DBIO::DuckDB::Diff::View - Diff operations for DuckDB views
VERSION
version 0.900007
DESCRIPTION
Represents a view-level diff operation: CREATE VIEW or DROP VIEW.
DBIO::DuckDB::Introspect::Tables lists a view under tables with kind => 'view', and the diff used to take it for a table: DROP TABLE for a view that had gone (Existing object ... is of type View, trying to drop type Table), ALTER TABLE ... ADD COLUMN for one that selects another column (Can only modify view with ALTER VIEW statement), and a view that was new was created as a table. A view is created as a view and removed as a view, and no column or index op is ever written for one.
Two views of one name are the same view when the text DuckDB keeps of their query (view_definition, a complete CREATE VIEW statement) has the same query once the spelling of the name, surrounding whitespace and a closing semicolon are set aside. Both sides are read from DuckDB, so the same declaration gives the same text. A changed view is a drop followed by a create; the drop is marked replaced, which "classify" in DBIO::Diff::Base counts as changing, not destructive.
ATTRIBUTES
view_name
The name of the view.
view_info
The view's entry in the tables section of the model it comes from: the target's for a create, the source's for a drop. A create needs its view_definition.
replaced
True on the drop of a changed view.
METHODS
diff
my @ops = DBIO::DuckDB::Diff::View->diff($source_views, $target_views);
Hashrefs of view entries keyed by name. A drop for a view only the source has, a create for one only the target has, both (drop first) for a view whose definition changed. Sorted by name.
as_sql
DROP VIEW "name";, or the target's own CREATE VIEW statement. A create whose view_info holds no definition throws: a view cannot be written from its columns.
summary
AUTHOR
DBIO Authors
COPYRIGHT AND LICENSE
Copyright (C) 2026 DBIO Authors
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.