NAME
DB::Object::Constraint::Foreign - Table Foreign Key Constraint Class
SYNOPSIS
use DB::Object::Constraint::Foreign;
my $foreign = DB::Object::Constraint::Foreign->new(
expr => q{FOREIGN KEY (lang) REFERENCES language(lang) ON DELETE RESTRICT},
fields => [qw( lang )],
match => 'simple',
on_delete => 'restrict',
on_update => 'nothing',
name => 'fk_user_info_lang',
table => 'language',
) || die( DB::Object::Constraint::Foreign->error, "\n" );
VERSION
v0.1.0
DESCRIPTION
This class represents a table foreign key constraint. It is instantiated by the structure method when retrieving the table structure details.
CONSTRUCTOR
new
To instantiate new object, you can pass an hash or hash reference of properties matching the method names available below.
METHODS
expr
Sets or gets the foreign key constraint expression.
It returns a scalar object
fields
Sets or gets an array reference of table field names associated with this constraint.
It returns a array object
match
Sets or gets the method a foreign key constraint matches.
For example: full
, partial
and simple
It returns a scalar object
name
Sets or gets the foreign key constraint name.
It returns a scalar object
on_delete
Sets or gets the action taken by the database upon deletion of this foreign key.
For example: nothing
, restrict
, cascade
, null
or default
It returns a scalar object
on_update
Sets or gets the action taken by the database upon update of this foreign key.
For example: nothing
, restrict
, cascade
, null
or default
It returns a scalar object
table
Sets or gets the table name for this foreign key.
It returns a scalar object
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
https://www.postgresql.org/docs/current/tutorial-fk.html
COPYRIGHT & LICENSE
Copyright(c) 2023 DEGUEST Pte. Ltd.
All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.