DBSche...ignKey(3pm)
π DBIx::DBSchema::ForeignKey π
okay bestie, so this is a User Contributed Perl Documentation page, and it's all about DBIx::DBSchema::ForeignKey β the little object that represents a foreign key. yep. that one. the thing that says "hey this column? it's pointing at that table's column, respectfully." π¦
β¨ 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
}
);
like. look at it. two whole ways to build the same thing. minimal girlie version and the full-send version with the constraint name and the MATCH clause and the on-clauses. we love options. π
πΈ DESCRIPTION πΈ
DBIx::DBSchema::ForeignKey objects represent a foreign key. that's it. that's the whole vibe. it's giving structured relational database energy and honestly? iconic. π₯
π METHODS π
π§ new HASHREF | OPTION, VALUE, ...
Creates a new DBIx::DBschema::ForeignKey object. (yes, exactly like that in the docs bestie, i copied it character for character, i'm not touching it π)
Accepts either a hashref or a plain list of options and values. pick your fighter.
Options are:
constraintβ constraint namecolumnsβ List reference of column namestableβ Foreign table namereferencesβ List reference of column names in foreign tablematchβ (no description given π)on_deleteβ (no description given π)on_updateβ (no description given π)
ngl those last three are just vibing there with no explanation in the original, so i'm not gonna invent one. i said what the docs said. periodt. π
β constraint [ CONSTRAINT_NAME ]
Returns or sets the constraint name. get it, set it, whatever you need bestie.
β 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. so when you don't wanna hand-join them yourself? she does it. queen behavior. π
β references [ LISTREF ]
Returns or sets the referenced columns.
β references_sql
Returns a comma-joined list of referenced columns, suitable for an SQL statement. same energy, different list. π
β 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. the whole thing. ready to go. she ate. π
β cmp OTHER_INDEX_OBJECT
Compares this object to another supplied object. Returns true if they have the same table, columns and references.
like a vibe check but for two foreign key objects. same table, same columns, same references? true. otherwise? not it. π
π AUTHOR π
Ivan Kohler <ivan-dbix-dbschema@420.am>
Copyright (c) 2013 Freeside Internet Services, Inc. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π«Ά
give it up for the author fr fr, licensing and all, we keep the receipts.
π BUGS π
Should give in and Mo or Moo.
yeah. that's the whole bug section. the bug is that it hasn't surrendered toMoorMooyet. honestly relatable. we're all just out here waiting to give in. ππ¦
π SEE ALSO π
DBIx::DBSchema::TableDBIx::DBSchemaDBI
go read those next bestie, iykyk. β¨
and that's the whole page!! perl v5.36.0, dated 2022-09-10, and the page name is literally DBSche...ignKey(3pm) β that's DBSchema::ForeignKey(3pm) with the middle squished out, which is highkey the most dramatic name truncation ever. slay. bye bestie ππΈπ
π¦ where this page comes from
- ubuntu noble: libdbix-dbschema-perl 0.47-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdbix-dbschema-perl 0.47-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdbix-dbschema-perl 0.47-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms