pitcheye.dev← All 30 rules
severity: errorpack: dbv1.0 core

db/neon-pooler-in-migrations

Pooler URL used for migrations

npx @pitcheye/check . --pack db

whyItBreaks

Migrations need session-level features (advisory locks, DDL in an explicit transaction, prepared statements) that a transaction pooler does not preserve. Against PgBouncer/Neon pooler you get intermittent DDL failures, half-applied migrations, and lock timeouts that are impossible to reproduce against a direct connection.

✖ Bad — triggers errorfixtures/db-neon-pooler-in-migrations/bad
dbCredentials: { url: 'postgresql://…-pooler.us-east-2.aws.neon.tech/neondb' }
✓ Good — passes checkfixtures/db-neon-pooler-in-migrations/good
dbCredentials: { url: process.env.DATABASE_URL_UNPOOLED! }

suggestedFix

Use the DIRECT (unpooled) connection string for drizzle-kit and scripts — on Neon `DATABASE_URL_UNPOOLED`, on Supabase the `db.<ref>.supabase.co:5432` host.

explain_rule({"db/neon-pooler-in-migrations"})

Agent & MCP JSON output contract

{
  "ruleId": "db/neon-pooler-in-migrations",
  "pack": "db",
  "severity": "error",
  "file": "apps/web/src/app/api/health/route.ts",
  "line": 6,
  "message": "a pooled connection string in drizzle.config / migrations / seed scripts",
  "whyItBreaks": "Migrations need session-level features (advisory locks, DDL in an explicit transaction, prepared statements) that a transaction pooler does not preserve. Against PgBouncer/Neon pooler you get intermittent DDL failures, half-applied migrations, and lock timeouts that are impossible to reproduce against a direct connection.",
  "suggestedFix": "Use the DIRECT (unpooled) connection string for drizzle-kit and scripts — on Neon `DATABASE_URL_UNPOOLED`, on Supabase the `db.<ref>.supabase.co:5432` host.",
  "docsUrl": "https://pitcheye.dev/rules/db-neon-pooler-in-migrations"
}

Markdown: curl -H "Accept: text/markdown" https://pitcheye.dev/rules/db-neon-pooler-in-migrations

raw markdown
# db/neon-pooler-in-migrations

- **severity:** error
- **pack:** db
- **docs:** https://pitcheye.dev/rules/db-neon-pooler-in-migrations

## whyItBreaks

Migrations need session-level features (advisory locks, DDL in an explicit transaction, prepared statements) that a transaction pooler does not preserve. Against PgBouncer/Neon pooler you get intermittent DDL failures, half-applied migrations, and lock timeouts that are impossible to reproduce against a direct connection.

## bad

```ts
dbCredentials: { url: 'postgresql://…-pooler.us-east-2.aws.neon.tech/neondb' }
```

## good

```ts
dbCredentials: { url: process.env.DATABASE_URL_UNPOOLED! }
```

## suggestedFix

Use the DIRECT (unpooled) connection string for drizzle-kit and scripts — on Neon `DATABASE_URL_UNPOOLED`, on Supabase the `db.<ref>.supabase.co:5432` host.

## commands

```bash
npx @pitcheye/check . --pack db
```

```json
{"tool":"explain_rule","arguments":{"ruleId":"db/neon-pooler-in-migrations"}}
```
← db/rls-permissive-using-trueBack to rule catalogdb/postgres-js-prepare-true-with-pooler →