How does drizzle-orm/migrator handle migrations that exist in the database but not in the filesystem

Context: We're using DrizzleORM in a Kubernetes deployment pipeline where database migrations run as a pre-deployment job. When we perform a Helm rollback to an older app version, the migration job runs again but with an older Docker image that contains fewer migration files than what's already been applied to the database. Scenario: - Database has migrations: 0000, 0001, 0002 already applied (tracked in drizzle.__drizzle_migrations) - Rollback deploys older image with only: 0000, 0001 in /migrations folder - Migration job runs: migrate(db, { migrationsFolder: '/migrations' }) What we observed: The migration command completed successfully with no errors, and the database remained unchanged (still has all 3 migrations applied, schema unchanged). Question: Is this the expected behavior? Does DrizzleORM's migrate() function: 1. Only apply forward migrations (files in filesystem not yet in DB)? 2. Silently ignore migrations that exist in DB but not in filesystem? 3. Never attempt to "rollback" or "revert" migrations? We couldn't find this explicitly documented. Can someone confirm this is the intended behavior, or point us to relevant documentation? Why this matters: We want to ensure Helm rollbacks are safe and won't cause migration-related failures or unexpected schema changes.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?