Description
Running sqlmesh rollback after downgrading from sqlmesh 0.224.0 to 0.209.0 raises a PostgreSQL dependency error. The process attempts to drop table sqlmesh._snapshots while view sqlmesh.model_snapshots still depends on it, causing the rollback to abort and leaving state objects partially reverted.
Error Snippet
psycopg2.errors.DependentObjectsStillExist: cannot drop table sqlmesh._snapshots because other objects depend on it
DETAIL: view sqlmesh.model_snapshots depends on table sqlmesh._snapshots
Steps to Reproduce
- Install and run with sqlmesh 0.224.0 (state initialized).
- Downgrade dependency to sqlmesh 0.209.0.
- Execute
sqlmesh rollback.
- Observe failure.
Actual Result
Rollback halts with a dependency error; state not fully rolled back.
Expected Result
Rollback completes without dependency errors and state objects are reverted consistently.
Impact
Prevents rollback during version downgrade; leaves residual state.
Environment
Database: PostgreSQL
Previous version: 0.224.0
Downgraded to: 0.209.0
Python: 3.10.x
Platform: Windows (dev environment)