The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

CXC::DB::DDL::Field - DDL Representation of a field

VERSION

version 0.13

OBJECT ATTRIBUTES

name => Str

field name

data_type => Enum [ SQL_TYPE_CONSTANTS ]

field SQL attribute type

is_nullable => Bool

Should this field be nullable? Defaults to false.

is_primary_key => Bool

Is this field the primary key? Defaults to false.

is_auto_increment => Bool

Does this field auto increment? Defaults to false.

foreign_key => NonEmptyStr | Dict [table => NonEmptyStr, field => Optional [NonEmptyStr] ]

If this field is linked to a foreign key, this attribute specifies the table containing the foreign key

If the keys have the same name, this attribute should specify the foreign key's table name.

If the keys have different names, set this to a hash with keys table and field, where field is the name in the other table.

Required if this column references a foreign key.

check => NonEmptyStr

Table check constraint

default_value => NonEmptyStr | ScalarRef | CodeRef

Default value for a field; may be a string, scalar ref or a coderef.

METHODS

has_foreign_key

Returns true if this field has a foreign key.

has_check

Returns true if a check constraint has been specified.

has_default_value

Default value

to_sqlt

  $sqlt_field = $field->to_sqlt( $dbh, $table );

Return a SQL::Translator::Schema::Field object for the field in $table

$dbh is a DBI data base handle.

$table is a SQL::Translator::Schema::Table object.

This method is typically not invoked by the user; it is called by "to_sqlt" in CXC::DB::DDL::Table;

SUPPORT

Bugs

Please report any bugs or feature requests to bug-cxc-db-ddl@rt.cpan.org or through the web interface at: https://rt.cpan.org/Public/Dist/Display.html?Name=CXC-DB-DDL

Source

Source is available at

  https://gitlab.com/djerius/cxc-db-ddl

and may be cloned from

  https://gitlab.com/djerius/cxc-db-ddl.git

SEE ALSO

Please see those modules/websites for more information related to this module.

AUTHOR

Diab Jerius <djerius@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2022 by Smithsonian Astrophysical Observatory.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007