sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

Skipping/Faking Migrations

Open Dosenpfand opened this issue 9 months ago • 1 comments

I have found these related issues/pull requests

Relates to #3706

Description

In my use case it would be helpful to be able to skip/fake migrations, i.e. mark migrations as done but not actually execute the SQL statements of the migration.

I have a system with existing migrations and deployments at different versions. I want to port the migrations to sqlx, and would therefore need to fake/skip already applied migrations, using my current migration method.

Prefered solution

I already hacked together a PoC for SQLite (duplicated code, no tests, etc.) in Dosenpfand/sqlx/migrations-skip. If there is interest in this I would be willing to prepare a proper implementation and open a PR.

An ideal solution would allow skipping migrations via sqlx::migrate::Migrator as well as via the cli e.g. sqlx migrate skip [OPTIONS]

Is this a breaking change? Why or why not?

Not necessarily

Dosenpfand avatar Apr 24 '25 13:04 Dosenpfand

I had a bit of time so I tried to add this feature and opened #3846 for it.

Dosenpfand avatar Apr 28 '25 06:04 Dosenpfand