首页 > 解决方案 > 如何调试卡住的迁移

问题描述

我正在开发一个带有遗留 grails 堆栈的项目,并且在启动应用程序时遇到问题,它在特定迁移时失败

grails dbm-status

在特定迁移中对我来说失败了(我认为?)

| 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)

所以我认为顶部只是“失败的东西”,具体是v0212.changelog找不到命名的迁移。但是迁移是在我的项目中,并且与我可以看到的所有其他迁移相同。

我还能做些什么来解决这个问题?- 如何找到“当前”迁移 - 如何启动 grails 而不是尝试运行所有迁移?

FWIWgrails console也因同样的错误而失败。

我尝试删除其他一些迁移,该应用程序将在下一个迁移中失败。我尝试删除整个迁移文件夹,但不知何故它仍然无法找到相同的文件。

▶ 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

标签: springgrailsmigration

解决方案


Grails 迁移插件将databasechangelog在数据库中创建表。您可以通过执行以下命令简单地查询表以检查上次执行的迁移脚本:

select * from databasechangelog
order by orderexecuted desc;

推荐阅读