NAME
DBIO::PostgreSQL::Diff::SequenceOwner - Diff operations for the column a PostgreSQL sequence belongs to
VERSION
version 0.900007
DESCRIPTION
Represents ALTER SEQUENCE ... OWNED BY: the statement that gives a sequence to a column, so that it goes when the column or its table goes, or takes it from one (OWNED BY NONE). Instances are produced by "diff" and consumed by DBIO::PostgreSQL::Diff.
It reads the same sequences section as DBIO::PostgreSQL::Diff::Sequence and is a class of its own because its statement has another place in the order: a sequence is created ahead of the table whose default calls it, and can be given to a column only when that column is there ("ORDER OF OPERATIONS" in DBIO::PostgreSQL::Diff). The action of its operations is own.
ATTRIBUTES
schema_name
The schema the sequence is in -- and the table, where it belongs to one: PostgreSQL gives a sequence to no table of another schema.
sequence_name
The name of the sequence.
table_name
The table whose column the sequence is to belong to. undef where it is to belong to none.
column_name
That column. undef where the sequence is to belong to none.
METHODS
diff
my @ops = DBIO::PostgreSQL::Diff::SequenceOwner->diff($source, $target);
Compares two sequences sections and returns an own operation for every sequence of its own ("is_own" in DBIO::PostgreSQL::Diff::Sequence) in the target that belongs to another column there than in the source, or to one on one side only -- and so for every sequence the diff creates that a column owns in the target: a new sequence belongs to none.
What a sequence belongs to is read from owned_by_table_name and owned_by_column ("fetch" in DBIO::PostgreSQL::Introspect::Sequences). A target entry without the key owned_by_table_name -- a model built by hand -- says nothing about it and asks for nothing.
A sequence the target takes from its column is taken ahead of the drops, so one that stays while its table or column goes is not taken along.
qualified_name
my $fqn = $op->qualified_name; # 'public.t_id_seq'
The schema and the name of the sequence joined with a dot, unquoted: what "summary" prints. It is not SQL.
as_sql
Returns ALTER SEQUENCE ... OWNED BY schema.table.column for an own operation with a table and a column, and ALTER SEQUENCE ... OWNED BY NONE for one with neither. Every name is written as an identifier by the server's rule ("quote_ident" in DBIO::PostgreSQL::Util); the table is written in the schema of the sequence.
It dies ("throw" in DBIO::PostgreSQL::Diff::NoStatement) for an action this class does not know, for a sequence without a name, and for an operation that names a table and no column or a column and no table.
summary
Returns a one-line description such as ~sequence: public.t_id_seq (owned by public.t.id), or ~sequence: public.t_id_seq (owned by none).
SEE ALSO
DBIO::PostgreSQL::Diff::Sequence - creates the sequence
DBIO::PostgreSQL::Introspect::Sequences - what the model holds of a sequence
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.