NAME
DBIO::MSSQL::Introspect::Columns - Introspect MSSQL columns
VERSION
version 0.900007
DESCRIPTION
Fetches column metadata via INFORMATION_SCHEMA.COLUMNS. Primary key information is joined in via INFORMATION_SCHEMA.KEY_COLUMN_USAGE + INFORMATION_SCHEMA.TABLE_CONSTRAINTS.
METHODS
fetch
my $columns = DBIO::MSSQL::Introspect::Columns->fetch($dbh, $schema, $tables);
Given the tables hashref from DBIO::MSSQL::Introspect::Tables, returns a hashref keyed by table name. Each value is an arrayref of column hashrefs in ordinal_position order with keys: column_name, data_type, not_null, default_value, is_pk, pk_position, is_identity, size, default_constraint_name, and on the columns of the primary key pk_constraint_name and pk_clustered.
pk_clustered is 1 when the index behind the primary key is CLUSTERED, 0 when it is NONCLUSTERED (sys.indexes, is_primary_key = 1), on each column of the key. It is compared (DBIO::MSSQL::Diff::PrimaryKey): the classes create the key clustered, and a live key that is not is replaced.
pk_constraint_name is the live name of the primary key, on each of its columns: the key is dropped by that name (DBIO::MSSQL::Diff::PrimaryKey), and a key created without a name has one the server made up. It is not compared.
default_constraint_name is the live, server-assigned name of the column's DEFAULT constraint (undef when the column has none). Transact-SQL has no ALTER COLUMN ... DROP DEFAULT: a default is an object in its own right and is removed with ALTER TABLE ... DROP CONSTRAINT <name>, so DBIO::MSSQL::Diff::Column cannot replace a default without knowing that name. It is carried for the same reason and on the same terms as the foreign-key constraint_name of the canonical model (ADR 0021): metadata for the diff/deploy layer, not a compared attribute -- two servers name the same default differently, so comparing it would make every deploy report a phantom change. DBIO::Diff::Compare::changed_column_fields does not look at it, and neither does DBIO::Introspect::Base::table_columns_info, which projects a fixed key set.
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.