NAME

DBIO::Oracle::Diff::Column - Diff operations for Oracle columns

VERSION

version 0.900007

DESCRIPTION

Column-level diff operations for Oracle. Oracle supports:

  • ALTER TABLE ... ADD column datatype [DEFAULT value]

  • ALTER TABLE ... DROP COLUMN column CASCADE CONSTRAINTS (the constraints the column is part of go with it; without the clause Oracle refuses a column of a multi-column constraint, ORA-12991)

  • ALTER TABLE ... MODIFY column datatype [DEFAULT value] [NULL|NOT NULL]

The table and the column are written double-quoted, as the model spells them and as the install (DBIO::Oracle::DDL) writes them; bare, Oracle would fold them to upper case and miss a table made in lower case.

Note: the diff does not recognise a renamed column. A column that exists only in the target is added and one that exists only in the source is dropped, so a rename becomes DROP + ADD and the data of the column is lost (Oracle itself has ALTER TABLE ... RENAME COLUMN, but nothing here emits it).

ATTRIBUTES

lossy_pairs

my %pairs = %DBIO::Oracle::Diff::Column::LOSSLESS_PAIRS;

The changes of the Oracle base type that keep every stored value, as the old->new keys "column_change_lossy" in DBIO::Diff::Compare reads: char to varchar2 (measured on Oracle Database 23ai Free: the trailing blanks of a CHAR value stay), nchar to nvarchar2 and date to timestamp. Every other change of the type is lossy, in doubt it is: varchar2 to char pads with blanks, a change between the database and the national character set may not be representable, timestamp to date cuts the fractions, number to float changes the decimal reading, and every change with a LOB changes the representation.

METHODS

diff

as_sql

lossy

True for an alter that can alter or lose stored values, so that "apply" in DBIO::Deploy::Base runs it only with allow_destructive. The answer is "column_change_lossy" in DBIO::Diff::Compare over the Oracle base types and the sizes of the types the two columns are written as, with the pairs of "lossy_pairs":

  • the size of the target is in every component at least that of the live column, the scale being equal; a NUMBER without a size is unlimited and holds every size;

  • VARCHAR2(20 CHAR) and VARCHAR2(20 BYTE) are not mixed: another length semantics is lossy, and so is another size that is no number;

  • a change within a pair of "lossy_pairs" keeps every value as long as the target is not shorter.

A change of NOT NULL or of the default alone is not lossy (NOT NULL over a NULL is refused by "_refuse_unfillable" in DBIO::Oracle::Deploy). add and drop answer false: a dropped column is a drop, which the diff classes as destructive by itself.

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.