Alzabo...ignKey(3pm)
π Alzabo::ForeignKey β foreign key (relation) objects π
okay bestie, welcome to the Alzabo::ForeignKey page from the User Contributed Perl Documentation section of the manual. it's giving β¨relationship loreβ¨ and honestly? we're obsessed. π«Ά
πΈ SYNOPSIS πΈ
use Alzabo::ForeignKey;
foreach my $fk ($table->foreign_keys)
{
print $fk->cardinality;
}
π¦ DESCRIPTION π¦
so. a foreign key is an object, right, and it's defined by a bunch of properties. what it actually represents is a relationship from a column (or several columns) in one table to a column (or several columns) in another table. it's the little red string connecting your tables, no cap. π
that relationship is defined by two things, bestie:
- its cardinality β one to one, one to many, or many to one
- its dependencies β like, whether table X is dependent on table Y, and vice versa
many to many relationships are NOT allowed. π however β and this is the slay part β you can indicate such a relationship when you're using the Alzabo::Create::Schema->add_relation method method (yes it says "method" twice, we love a typo with main character energy), and it will build the necessary intermediate linking table for you. iconic behaviour fr fr.
π METHODS π
π table_from / table_to
returns the relevant Alzabo::Table object. one for each end of the relationship. cute, simple, we love. π
π columns_from / columns_to
returns the relevant Alzabo::Column object(s) for the property as an array. yes, plural possible. she can hold multiple. β¨
π column_pairs
returns an array of array references. each of those references points at a two-column array of Alzabo::Column objects, and those two columns correspond to each other in the tables being linked together. it's basically shipping them. π₯°
π cardinality
returns a two element array containing the two portions of the cardinality of the relationship. each portion will be either '1' or 'n'. that's it. that's the whole vibe check. β
π from_is_dependent / to_is_dependent
returns a boolean value indicating whether there's a dependency from one table to the other. true/false, dependent/not, the whole will-they-won't-they. π
π is_one_to_one / is_one_to_many / is_many_to_one
returns a boolean value indicating what kind of relationship the object represents. three lil methods, three lil booleans, one big romance. π
π is_same_relationship_as ($fk)
give it a foreign key object and it returns true if the two objects represent the same relationship. plot twist though bestie: the two objects may represent the same relationship from different tables' points of view. same ship, different deck. π’
π id
returns a string uniquely identifying the foreign key. her government name. π
π comment
returns the comment associated with the foreign key object, if any. if there's no comment, there's just... no comment. literally. π
π AUTHOR π
Dave Rolsky, <autarch@urth.org>
and that's the whole page bestie, you ate it up π this lil manual page came to you via perl v5.34.0, dated 2022-06-14, straight out of the User Contributed Perl Documentation corner of the internet. periodt. π β¨
π¦ where this page comes from
- debian bookworm: libalzabo-perl 0.92-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libalzabo-perl 0.92-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libalzabo-perl 0.92-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libalzabo-perl 0.92-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libalzabo-perl 0.92-6 Β· 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