The Prototype of the Doppelganger Rows
Cloning entities and table structures through exact magical replication.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Illusion // Cloning
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SQL PATTERN //
-- Structural Cloning (Table Prototype)
CREATE TABLE shadow_grimoire (
LIKE ancient_grimoire INCLUDING ALL
);
-- Entity Cloning (Row Prototype)
CREATE OR REPLACE FUNCTION clone_demon_pact(pact_id UUID)
RETURNS UUID AS $$
DECLARE
new_pact_id UUID := gen_random_uuid();
BEGIN
INSERT INTO demon_pacts (id, demon_name, soul_cost, terms)
SELECT new_pact_id, demon_name, soul_cost, terms
FROM demon_pacts
WHERE id = pact_id;
RETURN new_pact_id;
END;
$$ LANGUAGE plpgsql;
The Prototype of the Doppelganger Rows
In the relational abyss, creating from scratch is costly. The Prototype pattern thrives as a mechanism of replication. Whether we are cloning the very fabric of a table (LIKE ... INCLUDING ALL) or duplicating an existing demonic contract via INSERT INTO ... SELECT, we achieve seamless replication.
This spell duplicates exact state without the overhead of re-invoking complex initiation rites, allowing the immediate deployment of shadow copies and experimental test subjects.
Runic Tags:
#clone
#copy
#creational