rust-db / refinery

Powerful SQL migration toolkit for Rust.
MIT License
1.34k stars 126 forks source link

Support a function similar to flyway baseline #298

Open JamesMc86 opened 11 months ago

JamesMc86 commented 11 months ago

I've just been investigating refinery as an alternative to flyway - primarily because the application is now being written in Rust and automation is a lot easier with refinery.

One problem though is that I need to migrate an existing database. I need to be able to set on the production database the current migration version so unneeded migrations aren't applied.

But I still want the full set available for testing.

For example:

. I have migrations 1,2 and 3. . The database has already had migrations 1 and 2 applied by other tools. . I want to run a command against the database to say "only apply migrations from 3" or similar.

JamesMc86 commented 10 months ago

I just noticed the -f flag in migrate.

So perhaps this would work by running flyway migrate -f -t 2? I'll have a chance to test it this week I hope.