skip to Main Content

I am working on a Spring project and I have FlyWay as a dependency to manage my migrations, I made a mistake on the SQL command. When I ran the project I got an error showing a problem with the script, a silly mistake that was easy to fix, I misspelled a column name. However, the undo command from the flyway is not working.

I was trying to undo a migration using FlyWay and I follow the tutorial from FlyWay documentation: link-flyway

However, I got this output:

C:Usersleonardo.freitasDocumentsworkspaceapi>C:Usersleonardo.freitasDocumentsworkspaceflyway-9.8.1flyway undo
A new version of Flyway is available
Upgrade to Flyway 9.8.2: https://rd.gt/2X0gakb
ERROR: The command 'undo' was not recognized. Make sure you have added 'flyway-proprietary' as a dependency.
Caused by: No command extension found to handle command: undo

That’s my migration history:

C:Usersleonardo.freitasDocumentsworkspaceapi>C:Usersleonardo.freitasDocumentsworkspaceflyway-9.8.1flyway info
A new version of Flyway is available
Upgrade to Flyway 9.8.2: https://rd.gt/2X0gakb
Flyway Community Edition 9.8.1 by Redgate
See what's new here: https://flywaydb.org/documentation/learnmore/releaseNotes#9.8.1

ERROR: Skipping filesystem location: sql (not found)
Database: jdbc:mysql://localhost:3306/volimed (MySQL 8.0)
Schema version: 5

+-----------+---------+----------------------------------------+------+---------------------+-----------------+----------+
| Category  | Version | Description                            | Type | Installed On        | State           | Undoable |

C:Usersleonardo.freitasDocumentsworkspaceapi>C:Usersleonardo.freitasDocumentsworkspaceflyway-9.8.1flyway info 
A new version of Flyway is available
Upgrade to Flyway 9.8.2: https://rd.gt/2X0gakb
Flyway Community Edition 9.8.1 by Redgate                                           
See what's new here: https://flywaydb.org/documentation/learnmore/releaseNotes#9.8.1

ERROR: Skipping filesystem location: sql (not found)
Database: jdbc:mysql://localhost:3306/volimed (MySQL 8.0)
Schema version: 5                                                                                                         
                                                                                                                          
+-----------+---------+----------------------------------------+------+---------------------+-----------------+----------+
| Category  | Version | Description                            | Type | Installed On        | State           | Undoable |
+-----------+---------+----------------------------------------+------+---------------------+-----------------+----------+
| Versioned | 1       | create-table-medicos                   | SQL  | 2022-11-19 03:12:19 | Future          | No       |
| Versioned | 2       | alter-table-medicos-add-telefone       | SQL  | 2022-11-19 13:32:45 | Future          | No       |
| Versioned | 3       | create-table-pacientes                 | SQL  | 2022-11-19 13:46:17 | Future          | No       |
| Versioned | 4       | alter-table-medicos-add-column-active  | SQL  | 2022-11-19 15:28:46 | Future          | No       |
| Versioned | 5       | alter-table-paciente-add-column-active | SQL  | 2022-11-19 15:45:28 | Failed (Future) | No       |
+-----------+---------+----------------------------------------+------+---------------------+-----------------+----------+

And I want to redu the last migration.

2

Answers


  1. Chosen as BEST ANSWER

    I find out a way to resolve this problem, I went to the FlyWay table and deleted the last row, when I ran the project the FlyWay applied the migration again.


  2. Undo command is supported in both the Teams and Enterprise edition . Flyway Enterprise is the only version with auto generation of Undo scripts though. Bill, could you point me towards where the information is conflicting?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search