Alzabo::Create::ForeignKey - Foreign key objects for schema creation.


NAME

Alzabo::Create::ForeignKey - Foreign key objects for schema creation.


SYNOPSIS

  use Alzabo::Create::ForeignKey;


DESCRIPTION

A foreign key is an object defined by several properties. It represents a relationship from a column in one table to a column in another table. This relationship can be described in this manner:

There is a relationship from column BAZ in table foo to column BOZ in table bar. For every entry in column BAZ, there must X..Y corresponding entries in column BOZ. For every entry in column BOZ, there must be Y..Z corresponding entries in column BAZ. X, Y, and Z are 0, 1, or n, and must form one of these pairs: 0..1, 0..n, 1..1, 1..n.

The properties that make up a foreign key are:

Cardinality is generated from the two min_max values. This is the max from to the max to. If min_max_from was 0..1 and min_max_to was 1..n then the cardinality of the relationship would be 1..n.


INHERITS FROM

Alzabo::ForeignKey

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


METHODS

new

Parameters:

Returns

A new Alzabo::Create::ForeignKey object.

table_from

table_to

Returns

The relevant Alzabo::Create::Table object.

columns_from

columns_to

Returns

The relevant Alzabo::Create::Column object(s) for the property.

column_pairs

Returns

An array of array references. The references are to two column array of Alzabo::Create::Column objects. These two columns correspond in the tables being linked together.

set_columns_from (Alzabo::Create::Column object(s))

Set the column(s) that the relation is from. This can be either a single a column object or a reference to an array of column objects.

set_columns_to (Alzabo::Create::Column object(s))

Set the column(s) that the relation is to. This can be either a single a column object or a reference to an array of column objects.

cardinality

This will be either 1..1 or 1..n.

Returns

A two element array containing the two portions of the cardinality of the relationship.

from_is_dependent

to_is_dependent

Returns

A boolean value indicating whether there is a dependency from one table to the other.

is_one_to_one

is_one_to_many

is_many_to_one

Returns

A boolean value indicating what kind of relationship the object represents.

set_min_max_from (\@min_max_value) see above for details

Sets the min_max value of the relation of the 'from' table to the 'to' table.

set_min_max_to (\@min_max_value) see above for details

Sets the min_max value of the relation of the 'to' table to the 'from' table.

NOTE: All the 'min_max' stuff is going to go away in favor of using cardinality and dependency terms.


AUTHOR

Dave Rolsky, <autarch@urth.org>

 Alzabo::Create::ForeignKey - Foreign key objects for schema creation.