1DBSchema::ForeignKey(3)User Contributed Perl DocumentatioDnBSchema::ForeignKey(3)
2
3
4
6 DBIx::DBSchema::ForeignKey - Foreign key objects
7
9 use DBIx::DBSchema::ForeignKey;
10
11 $foreign_key = new DBIx::DBSchema::ForeignKey (
12 { 'columns' => [ 'column_name' ],
13 'table' => 'foreign_table',
14 }
15 );
16
17 $foreign_key = new DBIx::DBSchema::ForeignKey (
18 {
19 'constraint' => 'constraint_name',
20 'columns' => [ 'column_name', 'column2' ],
21 'table' => 'foreign_table',
22 'references' => [ 'foreign_column', 'foreign_column2' ],
23 'match' => 'MATCH FULL', # or MATCH SIMPLE
24 'on_delete' => 'NO ACTION', # on clauses: NO ACTION / RESTRICT /
25 'on_update' => 'RESTRICT', # CASCADE / SET NULL / SET DEFAULT
26 }
27 );
28
30 DBIx::DBSchema::ForeignKey objects represent a foreign key.
31
33 new HASHREF | OPTION, VALUE, ...
34 Creates a new DBIx::DBschema::ForeignKey object.
35
36 Accepts either a hashref or a list of options and values.
37
38 Options are:
39
40 constraint - constraint name
41 columns - List reference of column names
42 table - Foreign table name
43 references - List reference of column names in foreign table
44 match -
45 on_delete -
46 on_update -
47 constraint [ CONSTRAINT_NAME ]
48 Returns or sets the constraint name
49
50 table [ TABLE_NAME ]
51 Returns or sets the foreign table name
52
53 columns [ LISTREF ]
54 Returns or sets the columns.
55
56 columns_sql
57 Returns a comma-joined list of columns, suitable for an SQL
58 statement.
59
60 references [ LISTREF ]
61 Returns or sets the referenced columns.
62
63 references_sql
64 Returns a comma-joined list of referenced columns, suitable for an
65 SQL statement.
66
67 match [ TABLE_NAME ]
68 Returns or sets the MATCH clause
69
70 on_delete [ ACTION ]
71 Returns or sets the ON DELETE clause
72
73 on_update [ ACTION ]
74 Returns or sets the ON UPDATE clause
75
76 sql_foreign_key
77 Returns an SQL FOREIGN KEY statement.
78
79 cmp OTHER_INDEX_OBJECT
80 Compares this object to another supplied object. Returns true if
81 they are have the same table, columns and references.
82
84 Ivan Kohler <ivan-dbix-dbschema@420.am>
85
86 Copyright (c) 2013 Freeside Internet Services, Inc. All rights
87 reserved. This program is free software; you can redistribute it
88 and/or modify it under the same terms as Perl itself.
89
91 Should give in and Mo or Moo.
92
94 DBIx::DBSchema::Table, DBIx::DBSchema, DBI
95
96
97
98perl v5.36.0 2023-01-20 DBSchema::ForeignKey(3)