Alzabo::Create::Table - Table objects for schema creation


NAME

Alzabo::Create::Table - Table objects for schema creation


SYNOPSIS

  use Alzabo::Create::Table;


DESCRIPTION

This class represents tables in the schema. It contains column, index, and foreign key objects.


INHERITS FROM

Alzabo::Table

Note: all relevant documentation from the superclass has been merged into this document.


METHODS

new

Parameters

Returns

A new Alzabo::Create::Table object.

Throws

Alzabo::Exception::Params

schema

Returns

The Alzabo::Create::Schema object to which this table belongs.

name

Returns

The name of the table.

set_name ($name)

Changes the name of the table.

column ($name)

Returns

The Alzabo::Create::Column object that matches the name given.

columns (@optional_list_of_column_names)

Returns

A list of Alzabo::Create::Column objects that match the list of names given. If no list is provided, then it returns all column objects for the table.

make_column

Creates a new Alzabo::Create::Column object and adds it to the table. This object is the function's return value.

In addition, if the before or after parameter is given, the move_column method is called to move the new column.

This method takes all of the same parameters as the Alzabo::Create::Column method except the table parameter, which is automatically added.

Additional Parameters

Returns

A new Alzabo::Create::Column object.

add_column

Adds a column to the table. If a before or after parameter is given then the move_column method will be called to move the new column to the appropriate position.

Parameters

Throws

Alzabo::Exception::Params

delete_column (Alzabo::Create::Column object)

Deletes a column from the table.

Throws

Alzabo::Exception::Params

move_column

Parameters

Throws

Alzabo::Exception::Params

primary_key

A primary key is one or more columns which must be unique in each row of the table. For a multi-column primary key, than the values of the columns taken in order must be unique. The order of a multi-column key is significant as most RDBMS's will create an index on the primary key using the same column order as is specified and column order usually matters in indexes.

Returns

An ordered list of column objects that make up the primary key for the table.

add_primary_key (Alzabo::Create::Column object)

Make the given column part of the table's primary key. The primary key is an ordered list of columns. The given column will be added to the end of this list.

Throws

Alzabo::Exception::Params

delete_primary_key (Alzabo::Create::Column object)

Delete the given column from the primary key.

Throws

Alzabo::Exception::Params

foreign_keys

Parameters

Returns

A list of Alzabo::Create::ForeignKey objects from the given column to the given table, if they exist. In scalar context, returns the first item in the list. There is no guarantee as to what the first item will be.

foreign_keys_by_table (Alzabo::Create::Table object)

Returns

A list of all the Alzabo::Create::ForeignKey objects to the given table. In scalar context, returns the first item in the list. There is no guarantee as to what the first item will be.

foreign_keys_by_column (Alzabo::Create::Column object)

Returns a list of all the Alzabo::Create::ForeignKey objects that the given column is a part of, if any. In scalar context, returns the first item in the list. There is no guarantee as to what the first item will be.

all_foreign_keys

Returns

A list of all the Alzabo::Create::ForeignKey objects for this table. In scalar context, returns the first item in the list. There is no guarantee as to what the first item will be.

make_foreign_key (see below)

Takes the same parameters as the Alzabo::Create::ForeignKey->new method except for the table parameter, which is automatically added. The foreign key object that is created is then added to the table.

returns

A new Alzabo::Create::ForeignKey object.

add_foreign_key (Alzabo::Create::ForeignKey object)

Adds the given foreign key to the table.

delete_foreign_key (Alzabo::Create::ForeignKey object)

Deletes the given foreign key from the table

Throws

Alzabo::Exception::Params

index ($index_id)

This method expect an index id as returned by the Alzabo::Create::Index->id method.

Returns

The Alzabo::Create::Index object matching this id, if it exists in the table.

indexes

Returns

All the Alzabo::Create::Index objects for the table.

make_index

Takes the same parameters as the Alzabo::Create::Index->new method except for the table parameter, which is automatically added. The index object that is created is then added to the table.

Returns

A new Alzabo::Create::Index object.

add_index (Alzabo::Create::Index object)

Adds the given index to the table.

Throws

Alzabo::Exception::Params

delete_index (Alzabo::Create::Index object)

Deletes an index from the table.

Throws

Alzabo::Exception::Params


AUTHOR

Dave Rolsky, <autarch@urth.org>

 Alzabo::Create::Table - Table objects for schema creation