| Alzabo documentation | view source | Contained in the Alzabo distribution. |
Alzabo::Create::Column object)Alzabo::Create::Column object)Alzabo::Create::Column object)Alzabo::Create::ForeignKey object)Alzabo::Create::ForeignKey object)Alzabo::Create::Index object)Alzabo::Create::Index object)Alzabo::Create::Table - Table objects for schema creation
use Alzabo::Create::Table;
This class represents tables in the schema. It contains column, index, and foreign key objects.
Alzabo::Table
The constructor takes the following parameters:
Alzabo::Create::Schema objectThe schema to which this table belongs.
An optional comment.
It returns a new Alzabo::Create::Table object.
Throws: Alzabo::Exception::Params|Alzabo::Exceptions
Changes the name of the table.
Throws: Alzabo::Exception::Params|Alzabo::Exceptions,
Alzabo::Exception::RDBMSRules|Alzabo::Exceptions
Creates a new Alzabo::Create::Column|Alzabo::Create::Column
object and adds it to the table. This object is the function's return
value.
In addition, if a "before" or "after" parameter is given, the
move_column()|move_column method is called to move the new
column.
This method takes all of the same parameters as the Alzabo::Create::Column->new()|Alzabo::Create::Column method except
the "table" parameter, which is automatically supplied.
This method also accepts an additional parameter, "primary_key", indicating whether or not the column is part of the table's primary key.
Returns a new Alzabo::Create::Column|Alzabo::Create::Column object.
Throws: Alzabo::Exception::Params|Alzabo::Exceptions,
Alzabo::Exception::RDBMSRules|Alzabo::Exceptions
Adds a column to the table. If a "before" or "after" parameter is
given then the move_column()|move_column method will be called
to move the new column to the appropriate position.
It takes the following parameters:
Alzabo::Create::Column objectAlzabo::Create::Column object (optional)... or ...
Alzabo::Create::Column object (optional)Throws: Alzabo::Exception::Params|Alzabo::Exceptions,
Alzabo::Exception::RDBMSRules|Alzabo::Exceptions
Alzabo::Create::Column object)Deletes a column from the table.
Throws: Alzabo::Exception::Params|Alzabo::Exceptions
This method takes the following parameters:
Alzabo::Create::Column objectThe column to move.
and either ...
Alzabo::Create::Column objectMove the column before this column
... or ...
Alzabo::Create::Column objectMove the column after this column.
Throws: Alzabo::Exception::Params|Alzabo::Exceptions
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|Alzabo::Exceptions
Alzabo::Create::Column object)Delete the given column from the primary key.
Throws: Alzabo::Exception::Params|Alzabo::Exceptions
Takes the same parameters as the
Alzabo::Create::ForeignKey->new|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.
If the foreign key being made is 1..1 or 1..n, then a unique index will be created on the columns involved in the "1" side of the foreign key, unless they are the table's primary key.
Returns a new
Alzabo::Create::ForeignKey|Alzabo::Create::ForeignKey object.
Throws: Alzabo::Exception::Params|Alzabo::Exceptions
Alzabo::Create::ForeignKey object)Adds the given foreign key to the table.
Throws: Alzabo::Exception::Params|Alzabo::Exceptions
Alzabo::Create::ForeignKey object)Deletes the given foreign key from the table
Throws: Alzabo::Exception::Params|Alzabo::Exceptions
Takes the same parameters as the Alzabo::Create::Index->new()|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 the new Alzabo::Create::Index|Alzabo::Create::Index
object.
Throws: Alzabo::Exception::Params|Alzabo::Exceptions
Alzabo::Create::Index object)Adds the given index to the table.
Throws: Alzabo::Exception::Params|Alzabo::Exceptions
Alzabo::Create::Index object)Deletes the specified index from the table.
Throws: Alzabo::Exception::Params|Alzabo::Exceptions
Sets the tables's attributes. These are strings describing the table (for example, valid attributes in MySQL are "TYPE = INNODB" or "AUTO_INCREMENT = 100").
You can also set table constraints as attributes. Alzabo will generate correct SQL for both actual attributes and constraints.
Add an attribute to the column's list of attributes.
Delete the given attribute from the column's list of attributes.
Alzabo::Exception::Params|Alzabo::Exceptions
If the table's name has been changed since the last time the schema was instantiated, this method returns the table's previous name.
Set the comment for the table object.
Dave Rolsky, <autarch@urth.org>
| Alzabo documentation | view source | Contained in the Alzabo distribution. |