nexent
nexent copied to clipboard
fix(database): make bootstrap and suadmin initialization idempotent
Problem
Fresh Kubernetes deployment can fail during database initialization because seeded role-permission IDs leave the sequence behind the current maximum, and the unified-tag trigger rejects the empty tenant identifier used by the super-admin mapping.
Expected behavior
Database bootstrap and super-admin initialization are repeatable and compatible with the platform super-admin tenant contract.
Acceptance
- Permission inserts cannot collide due to a stale sequence after initialization.
- Re-running migrations remains idempotent.
- Creating or reconciling the super-admin mapping succeeds without disabling triggers manually.
- Existing migration files remain immutable; corrective schema work is added through a new migration.