跳到主要内容

Flyway (flyway)

DeepSeek V3 中英对照 Flyway (flyway)

flyway 端点提供了由 Flyway 执行的数据库迁移的相关信息。

检索迁移

要检索迁移信息,请向 /actuator/flyway 发起一个 GET 请求,如下面的基于 curl 的示例所示:

$ curl 'http://localhost:8080/actuator/flyway' -i -X GET
bash

生成的响应类似于以下内容:

HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 515

{
"contexts" : {
"application" : {
"flywayBeans" : {
"flyway" : {
"migrations" : [ {
"type" : "SQL",
"checksum" : -156244537,
"version" : "1",
"description" : "init",
"script" : "V1__init.sql",
"state" : "SUCCESS",
"installedBy" : "SA",
"installedOn" : "2025-01-23T11:06:40.440Z",
"installedRank" : 1,
"executionTime" : 9
} ]
}
}
}
}
}
http

响应结构

响应包含应用程序的 Flyway 迁移的详细信息。下表描述了响应的结构:

路径类型描述
contextsObject按 id 键控的应用程序上下文
contexts.*.flywayBeans.*.migrationsArray由 Flyway 实例执行的迁移,按 Flyway bean 名称键控。
contexts.*.flywayBeans.*.migrations.[].checksumNumber迁移的校验和(如果有)。
contexts.*.flywayBeans.*.migrations.[].descriptionString迁移的描述(如果有)。
contexts.*.flywayBeans.*.migrations.[].executionTimeNumber已应用迁移的执行时间(以毫秒为单位)。
contexts.*.flywayBeans.*.migrations.[].installedByString安装已应用迁移的用户(如果有)。
contexts.*.flywayBeans.*.migrations.[].installedOnString已应用迁移的安装时间戳(如果有)。
contexts.*.flywayBeans.*.migrations.[].installedRankNumber已应用迁移的排名(如果有)。后续迁移的排名更高。
contexts.*.flywayBeans.*.migrations.[].scriptString用于执行迁移的脚本名称(如果有)。
contexts.*.flywayBeans.*.migrations.[].stateString迁移的状态。(PENDINGABOVE_TARGETBELOW_BASELINEBASELINE_IGNOREDBASELINEIGNOREDMISSING_SUCCESSMISSING_FAILEDSUCCESSUNDONEAVAILABLEFAILEDOUT_OF_ORDERFUTURE_SUCCESSFUTURE_FAILEDOUTDATEDSUPERSEDEDDELETED
contexts.*.flywayBeans.*.migrations.[].typeString迁移的类型。
contexts.*.flywayBeans.*.migrations.[].versionString应用迁移后的数据库版本(如果有)。
contexts.*.parentIdString父应用程序上下文的 id(如果有)。