The Bridge of the Dimensional Junction
Decoupling entities through an intermediate table of relation.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Bridge
ARCANUM SCHOOL: Conjuration // Relational Pact
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SQL PATTERN //
-- Hierarchy 1: The Mage
CREATE TABLE cyber_mages (
mage_id SERIAL PRIMARY KEY,
alias VARCHAR(100) NOT NULL
);
-- Hierarchy 2: The Grimoire
CREATE TABLE cyber_grimoires (
grimoire_id SERIAL PRIMARY KEY,
title VARCHAR(200) NOT NULL
);
-- The Bridge (Junction Table)
CREATE TABLE mage_grimoire_pact (
mage_id INT REFERENCES cyber_mages(mage_id) ON DELETE CASCADE,
grimoire_id INT REFERENCES cyber_grimoires(grimoire_id) ON DELETE CASCADE,
pact_date TIMESTAMP DEFAULT NOW(),
PRIMARY KEY (mage_id, grimoire_id)
);
The Bridge of the Dimensional Junction
When mages wield multiple grimoires, and grimoires are shared among numerous mages, a direct link causes a dimensional paradox (a many-to-many crisis). The Bridge pattern in SQL is the sacred Junction Table.
By introducing the mage_grimoire_pact, we decouple the two hierarchies. The bridge holds the foreign keys, acting as the structural contract that binds the entities together without forcing them into a rigid, singular lineage.
Runic Tags:
#junction-table
#bridge
#structural