How to skip a specific migration with flyway?

Iman

I'm using flyway with gradle, I've ran one of the migrations manually inside the database console, I want to run flyway, but tell it to ignore one specific migration version in between all the others. Can this be done ?

pards

You would have to hack it a bit to get it to work, so I don't recommend this approach, but it would work in a pinch.

I've only tested this with Maven, but I'm pretty sure it'd work with Gradle too.

  1. Migrate up until the version before the one you applied manually

    # Assuming you applied 01.002 manually
    $ mvn flyway:migrate -Dflyway.target=01.001
    
  2. Insert a row for the script you applied

    -- Make sure these vals closely replicate those from other rows
    insert into schema_version( installed_rank, version, description, type, script, checksum, installed_by, installed_on, execution_time, success) 
    values ( 2, '01.002', 'static_data', 'SQL', 'V01/V01.002__static_data.sql', null, 'username', current_timestamp, 0, true );
    
  3. Repair the schema_version checksum

    $ mvn flyway:repair
    
  4. Apply the other migrations

    $ mvn flyway:migrate -Dflyway.validateOnMigrate=false -Dflyway.outOfOrder=true
    

The two -D properties there may not be necessary, depending on whether you got the insert correct or not. Flyway may disagree with your script description, for example, even if the checksum is now correct.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to do partial migration in Flyway for testing?

From Java

How to rollback a specific migration?

From Dev

Flyway throwing error on migration script

From Dev

Flyway previous migration changed

From Dev

Flyway "Wrong migration name format"

From Dev

Flyway 3.0 Migration Checksum mismatch

From Dev

Flyway - Migrate to specific version

From Dev

How can I skip a migration with Django migrate command?

From Dev

How to handle realm migration if users skip updates

From Dev

How do I skip a plug for an specific page

From Dev

Flyway migration schema version

From Dev

Best practice: How to modify flyway migration script after it has been used

From Dev

Automatic generation of migration SQL for Flyway

From Dev

How many round trips to the database Flyway is doing to determine which migration have to be run?

From Dev

Flyway migration not working with gradle

From Dev

Flyway DB migration - how to access application services (Spring configured)

From Dev

Running a flyway java migration

From Dev

How to skip specific element in SimpleXML

From Dev

Flyway throwing error on migration script

From Dev

Flyway previous migration changed

From Dev

how to apply customization migration scripts in flyway

From Dev

Flyway "Wrong migration name format"

From Dev

How to use flyway with gradle? First migration depends on gradle build

From Dev

Flag to skip flyway migration sequence

From Dev

How to fake flyway migration?

From Dev

Flyway migration not working with gradle

From Dev

Flyway: How to remove a large migration script from migrations

From Dev

How to rollback a migration in Flyway Scala?

From Dev

Omitting certain migration files in Flyway

Related Related

HotTag

Archive