NAME

DBIO::Oracle::Diff::Unique - Diff operations for the unique constraints of Oracle tables

VERSION

version 0.900007

DESCRIPTION

Compares the unique constraints (the unique_constraints section of the models, per table a list of [ $name, \@columns ] pairs) of a table both models have and writes the difference: ALTER TABLE ... DROP CONSTRAINT for a constraint only the source has, ALTER TABLE ... ADD CONSTRAINT ... UNIQUE for one only the target has, and both, the drop first, for a constraint whose columns changed.

A constraint is its columns, in order: the names do not count, and a missing section counts as empty. The drop uses the name of the introspected source model, the add the name of the target model (the one DBIO::Oracle::DDL gave it in the install). A constraint over a column the target drops is not dropped here: the column goes with CASCADE CONSTRAINTS (DBIO::Oracle::Diff::Column). The unique constraints of a table that only the target has are written inline by DBIO::Oracle::Diff::Table.

ATTRIBUTES

table_name

The key of the table: a bare name, or schema.table.

constraint_name

The name of the constraint.

columns

ArrayRef of the column names of the constraint.

METHODS

diff

my @ops = DBIO::Oracle::Diff::Unique->diff(
    $source_unique, $target_unique, $source_tables, $target_tables, $target_columns,
);

The unique_constraints sections of the two models, their tables and the columns section of the target. Returns drop and create ops for each table both table sets have, in the order of the table names and of the constraints of the model, the drops of a table before its creates.

as_sql

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.