DBIx::DBSchema::ForeignKey - Foreign key objects
Contents
Bugs
Should give in and Mo or Moo.
Description
DBIx::DBSchema::ForeignKey objects represent a foreign key.
Methods
new HASHREF | OPTION, VALUE, ...
Creates a new DBIx::DBschema::ForeignKey object.
Accepts either a hashref or a list of options and values.
Options are:
constraint - constraint name
columns - List reference of column names
table - Foreign table name
references - List reference of column names in foreign table
match -
on_delete -
on_update -
constraint [ CONSTRAINT_NAME ]
Returns or sets the constraint name
table [ TABLE_NAME ]
Returns or sets the foreign table name
columns [ LISTREF ]
Returns or sets the columns.
columns_sql
Returns a comma-joined list of columns, suitable for an SQL statement.
references [ LISTREF ]
Returns or sets the referenced columns.
references_sql
Returns a comma-joined list of referenced columns, suitable for an SQL statement.
match [ TABLE_NAME ]
Returns or sets the MATCH clause
on_delete [ ACTION ]
Returns or sets the ON DELETE clause
on_update [ ACTION ]
Returns or sets the ON UPDATE clause
sql_foreign_key
Returns an SQL FOREIGN KEY statement.
cmp OTHER_INDEX_OBJECT
Compares this object to another supplied object. Returns true if they are have the same table,
columns and references.
Name
DBIx::DBSchema::ForeignKey - Foreign key objects
See Also
DBIx::DBSchema::Table, DBIx::DBSchema, DBI
perl v5.36.0 2022-09-10 DBSchema::ForeignKey(3pm)
Synopsis
use DBIx::DBSchema::ForeignKey;
$foreign_key = new DBIx::DBSchema::ForeignKey (
{ 'columns' => [ 'column_name' ],
'table' => 'foreign_table',
}
);
$foreign_key = new DBIx::DBSchema::ForeignKey (
{
'constraint' => 'constraint_name',
'columns' => [ 'column_name', 'column2' ],
'table' => 'foreign_table',
'references' => [ 'foreign_column', 'foreign_column2' ],
'match' => 'MATCH FULL', # or MATCH SIMPLE
'on_delete' => 'NO ACTION', # on clauses: NO ACTION / RESTRICT /
'on_update' => 'RESTRICT', # CASCADE / SET NULL / SET DEFAULT
}
);
