Skip to main content

Module cascade

Module cascade 

Source
Expand description

Cascade save: drain children from principal HasMany navigations, FK fixup after principal PK backfill, and M2M join-row insertion via direct SQL.

See cascade-save-plan.md for the full design. Key types:

  • DrainedChild: a child entity extracted from a principal’s HasMany, with parent linkage metadata.
  • FixupLink: records the parent→child association for post-INSERT FK fixup (one-to-many) or join-row insertion (M2M).

Structs§

CascadeDeleteDirective
A directive to delete or nullify untracked dependents of a Deleted principal. Generated during the cascade delete drain loop and executed as direct SQL at the start of the DELETE phase, before PK-based deletes.
DrainedChild
A child entity drained from a principal’s HasMany navigation, with the metadata needed to fixup its FK after the principal’s PK is backfilled.
FixupLink
Records a parent→child association for post-INSERT FK fixup.

Enums§

CascadeDeleteAction
The action to take for untracked dependents when a principal is deleted.

Functions§

m2m_insert_sql
Generates a batched INSERT INTO through_table (parent_col, child_col) VALUES (?, ?), (?, ?), ... statement for M2M join rows.