Berildocs GitHub

Memory cards

A polymorphic reference trades integrity for flexibility

confidence: mediumupdated: 2026-11-25status: activedata-modelingpolymorphicconstraints

Claim#

A type column plus an id cannot be a foreign key. An exclusive arc or a join table restores it.

Test#

Insert a reference with a wrong type. Check whether the database rejects it.

Proof#

A constraint that rejects an orphan reference.

Failure modes#

A type column without a check drifts. An exclusive arc adds nullable columns.