Description
warehouse
test suite currently executes 246 Alembic migrations sequentially during database setup, adding significant overhead to test execution times. I investigated squashing these migrations into a single migration that represents the current database state.
Using alembic
's automatic migration feature provides a good starting point, but requires manual review to address limitations:
- SQL functions are not automatically exported
- Triggers are not included in the export
Configuration | Full Tests | API Tests |
---|---|---|
With Squash | 19.69s | 3.12s |
Without Squash | 21.75s | 3.66s |
Note: Currently experiencing 128 failures out of 4402 tests in the full test suite, while API tests are passing successfully.
Proposed Implementation:
- Preserve historical migrations by moving them to
migrations/old/
- Replace current migrations with a single consolidated migration in
migrations/versions/
Primary Consideration:
The main tradeoff is losing the ability to easily roll back to intermediate database states. We could mitigate this by choosing an earlier cutoff date for the consolidated migration if needed.
I'm opening this issue to discuss if we should proceed forward before trying to fix every edge case in the migration.