Documentation
¶
Overview ¶
Package refsettle settles the rows whose reference points at a row that is gone, and then validates the foreign keys a migration added NOT VALID (ADR 0033: a migration only adds, the heavy data work runs afterwards). The references date from before they were foreign keys (an Erasure, an erased Template): a row either goes with the row it named (it died with it) or only the dangling id goes (it outlives it), the way the key's `ON DELETE` would have. A new write cannot dangle, since the keys are enforced from the migration on, so once a key is validated every run finds nothing.
The settling reads and writes every Workspace's rows, so the module holds the raw ent client. The jobs only call it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Settler ¶
type Settler struct {
// contains filtered or unexported fields
}
Settler settles dangling references on the raw ent client.
func (*Settler) ClearContactRefs ¶
ClearContactRefs settles, table by table, the rows that name a Contact which is gone (at most batch rows per step, so no long lock; a run interrupted halfway finishes on the next), and validates each key that is still NOT VALID once its table is clean. It returns how many rows it settled.
func (*Settler) ClearOutboundMessageRefs ¶
ClearOutboundMessageRefs clears, reference by reference, the ids of Outbound messages that point at nothing (at most batch rows per step, so no long lock; a run interrupted halfway finishes on the next), and validates each key that is still NOT VALID once its column is clean. It returns how many ids it cleared. A message keeps everything else: only the dangling id goes.