DB-Object

 view release on metacpan or  search on metacpan

lib/DB/Object/Constraint/Foreign.pm  view on Meta::CPAN


    v0.2.0

=head1 DESCRIPTION

This class represents a table foreign key constraint. It is instantiated by the L<structure|DB::Object::Tables/structure> method when retrieving the table structure details.

=head1 CONSTRUCTOR

=head2 new

To instantiate new object, you can pass an hash or hash reference of properties matching the method names available below.

=head1 METHODS

=head2 expr

    my $value = $constraint->expr;
    $constraint->expr( $value );

Sets or gets the foreign key constraint expression.

It returns a L<scalar object|Module::Generic::Scalar>

=head2 fields

    my $value = $constraint->fields;
    $constraint->fields( $value );

Sets or gets an array reference of table field names associated with this constraint.

It returns a L<array object|Module::Generic::Array>

=head2 match

    my $value = $constraint->match;
    $constraint->match( $value );

Sets or gets the method a foreign key constraint matches.

For example: C<full>, C<partial> and C<simple>

It returns a L<scalar object|Module::Generic::Scalar>

=head2 name

    my $value = $constraint->name;
    $constraint->name( $value );

Sets or gets the foreign key constraint name.

It returns a L<scalar object|Module::Generic::Scalar>

=head2 on_delete

    my $value = $constraint->on_delete;
    $constraint->on_delete( $value );

Sets or gets the action taken by the database upon deletion of this foreign key.

For example: C<nothing>, C<restrict>, C<cascade>, C<null> or C<default>

It returns a L<scalar object|Module::Generic::Scalar>

=head2 on_update

    my $value = $constraint->on_update;
    $constraint->on_update( $value );

Sets or gets the action taken by the database upon update of this foreign key.

For example: C<nothing>, C<restrict>, C<cascade>, C<null> or C<default>

It returns a L<scalar object|Module::Generic::Scalar>

=head2 table

    my $value = $constraint->table;
    $constraint->table( $value );

Sets or gets the table name for this foreign key.

It returns a L<scalar object|Module::Generic::Scalar>

=head1 AUTHOR

Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>

=head1 SEE ALSO

L<https://www.postgresql.org/docs/current/tutorial-fk.html>

=head1 COPYRIGHT & LICENSE

Copyright(c) 2023-2026 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.

=cut



( run in 2.883 seconds using v1.01-cache-2.11-cpan-f1796dc4e6b )