NAME

CXC::DB::DDL::Table - CXC::DB::DDL Table class

VERSION

version 0.14

OBJECT ATTRIBUTES

name

The table name

schema

The schema that the table is in. If not specified, The "name" attribute is scanned for the schema, under the assumption that the form is

<schema>.<table name>

indexes

The list of table indexes

constraints

One or more table constraints, either as a single constraint or an array of constraints.

The constraints must meet the "Constraint" in CXC::DB::DDL::Types type.

If the constraint attribute expression is a coderef, it is called as

$expression->( $dbh, $sqlt, $constraint )

where $dbh is DBI handle, $sqlt is the SQL::Translator object, and must return a scalar containing the final expression. This is typically used to ensure that identifiers are properly quoted. See "quote" in DBI and "quote_identifier" in DBI.

$dbh, $sqlt and $constraint must not be changed.

checks

DEPRECATED; add an entry to "constraints" with fields

type => CHECK_C, expression => $expr

The list of table check constraints

fields

The list of fields

METHODS

has_schema

true if the "schema" attribute was set.

to_sqlt

$sqlt_table = $table->to_sqlt( $dbh, $schema );

Return a SQL::Translator::Schema::Table object for the table. Requires a DBI data base handle and an SQL::Translator::Schema object.

exists

$bool = $table->exists;

Check if the table exists in the database

field_names

\@field_names = $table->field_names;

return the names of all of the fields

clear

$table->clear;

clear the rows from the table

drop

$table->drop;

delete the table from the database

add_to_schema

$table->add_to_schema( $dbh, $schema );

Add the table to the schema (a SQL::Translator::Schema object).

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