Flyway (flyway)

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

获取迁移信息

要获取迁移信息,向 /actuator/flyway 发送 GET 请求,如下面的基于 curl 的示例所示:

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

响应结果类似于以下内容:

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

{
  "contexts" : {
    "application" : {
      "flywayBeans" : {
        "flyway" : {
          "migrations" : [ {
            "type" : "SQL",
            "checksum" : -156244537,
            "version" : "1",
            "description" : "init",
            "script" : "V1__init.sql",
            "state" : "SUCCESS",
            "installedBy" : "SA",
            "installedOn" : "2025-05-25T10:02:40.576Z",
            "installedRank" : 1,
            "executionTime" : 12
          } ]
        }
      }
    }
  }
}

响应结构

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

Path Type Description

contexts

Object

Application contexts keyed by id

contexts.*.flywayBeans.*.migrations

Array

Migrations performed by the Flyway instance, keyed by Flyway bean name.

contexts.*.flywayBeans.*.migrations.[].checksum

Number

Checksum of the migration, if any.

contexts.*.flywayBeans.*.migrations.[].description

String

Description of the migration, if any.

contexts.*.flywayBeans.*.migrations.[].executionTime

Number

Execution time in milliseconds of an applied migration.

contexts.*.flywayBeans.*.migrations.[].installedBy

String

User that installed the applied migration, if any.

contexts.*.flywayBeans.*.migrations.[].installedOn

String

Timestamp of when the applied migration was installed, if any.

contexts.*.flywayBeans.*.migrations.[].installedRank

Number

Rank of the applied migration, if any. Later migrations have higher ranks.

contexts.*.flywayBeans.*.migrations.[].script

String

Name of the script used to execute the migration, if any.

contexts.*.flywayBeans.*.migrations.[].state

String

State of the migration. (PENDING, ABOVE_TARGET, BELOW_BASELINE, BASELINE_IGNORED, BASELINE, IGNORED, MISSING_SUCCESS, MISSING_FAILED, SUCCESS, UNDONE, AVAILABLE, FAILED, OUT_OF_ORDER, FUTURE_SUCCESS, FUTURE_FAILED, OUTDATED, SUPERSEDED, DELETED)

contexts.*.flywayBeans.*.migrations.[].type

String

Type of the migration.

contexts.*.flywayBeans.*.migrations.[].version

String

Version of the database after applying the migration, if any.

contexts.*.parentId

String

Id of the parent application context, if any.