-
Notifications
You must be signed in to change notification settings - Fork 0
Multi Database Behavior
Ngan Pham edited this page Feb 24, 2026
·
1 revision
FixtureKit stores restore SQL keyed by model class name and replays per model connection.
At replay time, FixtureKit:
- Constantizes cached model names.
- Uses each model's
connection. - Groups SQL statements by connection.
- Replays table clears + inserts inside that connection.
This routes writes to the same database handlers used by those models (for example, primary, analytics, etc.).
During generation, FixtureKit subscribes to sql.active_record and tracks models for names matching write operations (Insert/Upsert/Create/Update/Delete/Destroy and supported bulk variants).
- Ensure your fixture generation touches the same models your tests need.
- If a model's data is expected but missing, verify that model had a write during generation.