Dave Rolsky

NAME

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

SYNOPSIS

  use Alzabo::Create::ForeignKey;

INHERITS FROM

Alzabo::ForeignKey

METHODS

new

The constructor takes the following parameters:

  • columns_from => Alzabo::Create::Column object(s)

  • columns_to => Alzabo::Create::Column object(s)

    These two parameters may be either a single column or a reference to an array columns. The number of columns in the two parameters must match.

  • cardinality => [1, 1], [1, 'n'], or ['n', 1]

  • from_is_dependent => $boolean

  • to_is_dependent => $boolean

  • comment => $comment

    An optional comment.

It returns a new Alzabo::Create::ForeignKey object.

Throws: Alzabo::Exception::Params

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

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

Throws: Alzabo::Exception::Params

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

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

Throws: Alzabo::Exception::Params

set_cardinality (\@cardinality) see above for details

Sets the cardinality of the foreign key.

Throws: Alzabo::Exception::Params

set_from_is_dependent ($boolean)

Indicates whether or not the first table in the foreign key is dependent on the other (i.e. whether the 'from' table is dependent on the 'to' table).

set_to_is_dependent ($boolean)

Indicates whether or not the second table in the foreign key is dependent on the other (i.e. whether the 'to' table is dependent on the 'from' table).

set_comment ($comment)

Sets the comment for the foreign key object.

AUTHOR

Dave Rolsky, <autarch@urth.org>