PgBeam Docs
Migrations

LintMigration

Lint a migration

Analyzes a migration script for unsafe schema changes and returns findings.

Usage

result, err := client.Migrations.LintMigration(ctx, "prj_xxx", pgbeam.MigrationLintRequest{
    SQL: "...",
  })

Parameters

ParameterTypeRequiredDescription
ctxcontext.ContextYesRequest context
projectIDstringYesUnique project identifier (prefixed, e.g. prj_xxx).
reqpgbeam.MigrationLintRequestYesRequest body
req.SQLstringYesThe migration SQL to analyze. May contain multiple statements.
req.DatabaseID*stringNoOptional database to scope the lint to.

Response

(*pgbeam.MigrationLintResponse, error) — lint results.

Example

import pgbeam "go.pgbeam.com/sdk"

client := pgbeam.NewClient(&pgbeam.ClientOptions{
  APIKey: "pgb_your_api_key",
})

result, err := client.Migrations.LintMigration(ctx, "prj_xxx", pgbeam.MigrationLintRequest{
    SQL: "...",
    DatabaseID: "...",
  })
if err != nil {
  log.Fatal(err)
}
fmt.Println(result)

Errors

StatusDescription
400Invalid request parameters.
401Missing or invalid authentication.
403Operation not allowed by current plan limits.
404Resource not found.

On this page