Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-3407

database validate script fails when it encounters an ignored FlyWay migration



    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 6.0
    • Fix Version/s: None
    • Component/s: DSpace API
    • Labels:
    • Environment:
      recently upgraded 5x to 6x instance of DSpace, postgreSQL
    • Attachments:
    • Comments:
    • Documentation Status:
      Complete or Committed


      After successfully migrating a 5x database to 6x, I ran the dspace database info command and noticed one migration was "ignored"

      | 4.9.2015.10.26 | DS-2818 registry update                          |                     | Ignored |

      It seems that it is acceptible for the flyway migration to fix DS-2818 to be ignored. However, running the database validate command throws an error:

      bin/dspace database validate
      Database URL: jdbc:postgresql://localhost:5432/ds5
      Attempting to validate database status (and migration checksums) via FlywayDB...
      Validation exception:
      org.flywaydb.core.api.FlywayException: Validate failed: Detected resolved migration not applied to database: 4.9.2015.10.26
      	at org.flywaydb.core.Flyway.doValidate(Flyway.java:1008)
      	at org.flywaydb.core.Flyway.access$100(Flyway.java:72)
      	at org.flywaydb.core.Flyway$2.execute(Flyway.java:982)
      	at org.flywaydb.core.Flyway$2.execute(Flyway.java:979)
      	at org.flywaydb.core.Flyway.execute(Flyway.java:1373)
      	at org.flywaydb.core.Flyway.validate(Flyway.java:979)
      	at org.dspace.storage.rdbms.DatabaseUtils.main(DatabaseUtils.java:259)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:229)
      	at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:81)

      Discussed during today's developer meeting in IRC, Tim Donohue notes:

      "The validation script literally just runs Flyway's 'validate' command. It might throw errors on ignored migrations...not sure. If so, maybe we should see if there's a way to tell Flyway's 'validate' that ignored migrations are 'warnings' instead."

      And further suggests:

      "Also, if it really bugs you locally, you could run "./dspace database migrate ignored" (which runs any old migrations flagged as ignored). In this scenario it won't hurt, as that old migration will be a noop. But, it's best to not generally run migrations "out of order" (which is what that does)"




            • Assignee:
              hardyoyo Hardy Pottinger
              hardyoyo Hardy Pottinger
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: