> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# migration-constraint-not-valid

> A constraint is added and validated in one step instead of NOT VALID first.

## What it flags

Adding a PostgreSQL `CHECK` or foreign key constraint to an existing table without `NOT VALID`, or validating a constraint in the same transaction that added it `NOT VALID`.

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "migration-constraint-not-valid": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.