drizzle-team / drizzle-team/drizzle-orm

[BUG]: PostgreSQL: All schemas and tables are owned by specific user instead of pg_database_owner

Open
#4,657 0 comments 2 reactions 0 assignees View on GitHub
bug drizzle/kit enhancement
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?

0.41.0

### What version of `drizzle-kit` are you using?

0.30.6

### Other packages

_No response_

### Describe the Bug

When using Drizzle with PostgreSQL, all created schemas and tables — including the `drizzle` schema and the `__drizzle_migrations` table — are owned by the current user, rather than by a general role like pg_database_owner.

This creates issues when:
- Migrating databases to new environments
- Changing the PostgreSQL user
- Using managed setups with restricted user permissions

Because the ownership is tied to a specific user, permissions break unless ownership is manually reassigned.

Suggested improvements:
- Use pg_database_owner for ownership where possible
- Or allow configuration of schema/table ownership
- Document the current ownership behavior and its implications

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.