[Schema] Tree Forking Model - Database Schema #36
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
Implement tree forking schema to enable engineers to fork company trees, customize them, and track parent tree updates.
Design Document
See:
docs/plans/2026-02-07-foundational-schema-design.md(Part 1)Database Changes
Migration 022: Add Tree Forking Fields
Add three columns to
treestable:parent_tree_id(UUID nullable, FK to trees.id, ondelete SET NULL)fork_reason(String 255)parent_updated_at(Datetime nullable)Index:
ix_trees_parent_tree_idModel Updates
parentrelationship (many-to-one)forksrelationship (one-to-many)Key Behaviors
Acceptance Criteria
Related Issues
Part of foundational schema work (Issue #11)
Completed in PR #39. Migration 022 adds
parent_tree_id,root_tree_id,fork_depth,fork_reason, andparent_updated_atto the trees table. Self-referential relationships working with 9 passing tests covering fork creation, lineage, access control, and structure preservation.