drizzle-team / drizzle-team/drizzle-orm
`migrate` fails due to permission issues despite being able to run SQL manually using same account
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
I am working in a locked-down database. I have full permission on `public` schema. I have `migrations.schema` set to `public` in `drizzle.config.ts`. I am getting a permission denied error when running `drizzle-kit migrate`. However, I can run the SQL manually. `drizzle-kit push` also works without error.
```js
// drizzle.config.ts
// ...
verbose: true,
migrations: {
table: 'migrations',
schema: 'public',
},
// ...
```
### Error in question
```bash
Using 'pg' driver for database querying
[⣯] applying migrations...error: permission denied for database DATABASE_NAME
// ...
{
length: 110,
severity: 'ERROR',
code: '42501',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'aclchk.c',
line: '3652',
routine: 'aclcheck_error'
}
```
```
"drizzle-orm": "^0.31.0",
"drizzle-kit": "^0.22.1",
```
My initial thought is there might be a check against the default `drizzle` schema prior to using the config one which is causing the command to fail since I do not have permissions for it.
Running this on a non-locked down database (where I can create schemas) works fine as you'd expect.
Contributor guide
Assessment
This issue has not been assessed yet.