The self-referential FK on entitlement_features.parent_feature_id used
nullOnDelete(), which orphaned child features when a parent was deleted.
Children that belong to a pool have no meaning without their parent, so
cascade deletion is the correct behaviour.
Adds a migration that drops and re-creates the FK with cascadeOnDelete().
Fixes#40
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add foreign key constraints from usage_alert_history.feature_code,
entitlement_boosts.feature_code, and entitlement_usage_records.feature_code
to entitlement_features.code to prevent orphaned records.
Uses cascadeOnUpdate (code renames propagate) and restrictOnDelete
(cannot delete a feature that has usage/alert/boost records).
Fixes#12
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change namespaces.workspace_id FK from nullOnDelete to cascadeOnDelete
so that namespaces are properly cleaned up when their parent workspace
is deleted, instead of being orphaned with a null workspace_id.
Fixes#10
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>