---
title: "migrations lint"
description: "Lint a migration for unsafe DDL"
canonical: "https://pgbeam.com/docs/cli/migrations/lint"
last-updated: "2026-09-14T19:37:21.000Z"
---

# migrations lint

> Lint a migration for unsafe DDL

URL: https://pgbeam.com/docs/cli/migrations/lint

Lint migration SQL for unsafe DDL patterns before applying it. Detects operations that can lock tables, break replication, or cause downtime (such as adding NOT NULL columns without a default, dropping columns, or rewriting large tables) and reports findings with severity, the offending statement, and a remediation hint. Provide SQL inline as an argument or from a file with --file.

## Usage

## Options

Option

Description

Required

Default

`<sql>`

Inline SQL to lint

No

-

`--file <value>`

Path to a .sql file to lint

No

-

`--database <value>`

Database ID to scope the lint to

No

-

All global options (`--token`, `--profile`,
`--project`, `--org`, `--json`, `--no-color`, `--no-trunc`, `--debug`) are
also available on this command.

## Examples

## Output

Prints whether the migration is safe and lists any findings with their severity, rule, message, hint, and offending statement. With `--json`, returns an object with `safe` and `findings`.