PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, April 14, 2022

[FIXED] how to debug a stuck migration

 April 14, 2022     grails, migration, spring     No comments   

Issue

I'm working on a project with a legacy grails stack, and having problems starting the app, it fails on specific migrations

grails dbm-status

Is failing for me on a specific migration (I think?)

| Error Error executing script DbmUpdate: 
org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'grailsApplication': 
Bean instantiation via constructor failed; 
nested exception is org.springframework.beans.BeanInstantiationException: 
Failed to instantiate [org.codehaus.groovy.grails.commons.DefaultGrailsApplication]: 
Constructor threw exception; 
nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: 

Class not found loading Grails application: v0212.changelog 
(Use --stacktrace to see the full trace)

So I think the top is all just 'something failed' and the specific is that the migration named v0212.changelog cannot be found. However the migration IS in my project, and identical to all the other migrations that I can see.

What else can I do to poke around on this? - how can I find the "current" migration - how to startup grails and NOT try to run all the migrations?

FWIW grails console also fails with the same error.

I tried removing some other migrations, and the app will just fail on the next one. I tried deleting the whole migrations folder and somehow it still fails looking for that same file.

▶ grails --version
Grails version: 2.5.6

▶ java -version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

▶ mysql --version
mysql  Ver 14.14 Distrib 5.6.47, for osx10.15 (x86_64) using  EditLine wrapper


Solution

Grails migration plugin will create databasechangelog table in the database. You can simply query the table to check about the last executed migration script by executing the below command:

select * from databasechangelog
order by orderexecuted desc;


Answered By - Prashant Sahi
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing