Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: Update managing-environments.mdx | updated section on permission errors (#41802)

TheOtherBrian1f2e354471aae
diff --git a/apps/docs/content/guides/deployment/managing-environments.mdx b/apps/docs/content/guides/deployment/managing-environments.mdx
index b2319c1cbca..e81bda864b1 100644
--- a/apps/docs/content/guides/deployment/managing-environments.mdx
+++ b/apps/docs/content/guides/deployment/managing-environments.mdx
@@ -380,22 +380,12 @@ grant all on all sequences in schema graphql to postgres, anon, authenticated, s
### Permission denied on `db push`
-If you created a table through Supabase dashboard, and your new migration script contains `ALTER TABLE` statements, you might run into permission error when applying them on staging or production databases.
-
-```bash
-ERROR: must be owner of table employees (SQLSTATE 42501); while executing migration <timestamp>
-```
-
-This is because tables created through Supabase dashboard are owned by `supabase_admin` role while the migration scripts executed through CLI are under `postgres` role.
-
-One way to solve this is to reassign the owner of those tables to `postgres` role. For example, if your table is named `users` in the public schema, you can run the following command to reassign owner.
+If you create a table using a custom database role, the default `postgres` user may lack permission to modify it. This can cause `42501` privilege errors during migrations. To resolve this, grant the 'postgres` user ownership of the custom role.
```sql
-ALTER TABLE users OWNER TO postgres;
+grant "custom_role" to "postgres";
```
-Apart from tables, you also need to reassign owner of other entities using their respective commands, including [types](https://www.postgresql.org/docs/current/sql-altertype.html), [functions](https://www.postgresql.org/docs/current/sql-alterroutine.html), and [schemas](https://www.postgresql.org/docs/current/sql-alterschema.html).
-
### Rebasing new migrations
Sometimes your teammate may merge a new migration file to git main branch, and now you need to rebase your local schema changes on top.