drizzle-team / drizzle-team/drizzle-orm
[BUG]: drizzle-kit push tries to DROP Neon system roles despite provider: "neon"
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [x] I have verified that the bug I'm about to report hasn't been filed before.
### What version of `drizzle-orm` are you using?
1.0.0-rc.4
### What version of `drizzle-kit` are you using?
1.0.0-rc.4
### Other packages
_No response_
### Describe the Bug
On a Neon database, `drizzle-kit push` tries to drop Neon's internal roles (`cloud_admin`, `neon_service`), even though my schema has no `pgRole` at all and the config sets `entities: { roles: { provider: 'neon' } }`. Neon denies the drop, so push always fails:
```
┌── query error: permission denied to drop role
DROP ROLE "cloud_admin";
└──
```
Two problems:
1. Role diffing runs even when the schema declares no roles. It also happens with no `entities` block in the config at all.
2. The `provider: 'neon'` exclusion list doesn't cover Neon's current system roles. Adding `exclude: ['cloud_admin']` just fails on the next one, `DROP ROLE "neon_service"`.
This didn't happen on earlier 1.0.0 betas — probably because #5896 (config-file `entities` silently stripped, fixed in rc.4) was masking it.
**Steps to reproduce**
1. Any Neon project; a schema with normal tables and no `pgRole`.
2. Config:
```ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
schema: "./src/schema/index.ts",
out: "./migrations",
dialect: "postgresql",
dbCredentials: { url: process.env.DATABASE_URL! },
entities: {
roles: {
provider: "neon",
},
},
});
```
3. `drizzle-kit push` → fails on `DROP ROLE "cloud_admin"`.
4. Add `exclude: ['cloud_admin']` → fails on `DROP ROLE "neon_service"`.
**Workaround:** `entities: { roles: false }` — push then completes with `No changes detected`.
**Expected:** with `provider: 'neon'` (or no roles in the schema), push shouldn't touch Neon's system roles and should report `No changes detected` on an in-sync schema.
I'm using `push` for local development (`generate` + `migrate` in production), so I can't push any schema changes right now.
Contributor guide
Research direction
Start with the drizzle-kit push role-diffing path and the handling of entities.roles.provider for Neon, reproducing the report against a Neon database with a schema containing no pgRole entries. Done means an in-sync schema reports No changes detected without attempting to drop cloud_admin or neon_service, both with the Neon provider and without a roles configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, typescript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100