diff --git a/apps/docs/content/guides/deployment/managing-environments.mdx b/apps/docs/content/guides/deployment/managing-environments.mdx index b2319c1cbca02..e81bda864b1e6 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 -``` - -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. diff --git a/apps/studio/components/interfaces/Database/Replication/Destinations.tsx b/apps/studio/components/interfaces/Database/Replication/Destinations.tsx index a33e080dfbe4e..e92d0588d6044 100644 --- a/apps/studio/components/interfaces/Database/Replication/Destinations.tsx +++ b/apps/studio/components/interfaces/Database/Replication/Destinations.tsx @@ -42,7 +42,6 @@ export const Destinations = () => { const queryClient = useQueryClient() const { ref: projectRef } = useParams() const { data: organization } = useSelectedOrganizationQuery() - const isPaidPlan = organization?.plan.id !== 'free' const unifiedReplication = useFlag('unifiedReplication') @@ -191,7 +190,7 @@ export const Destinations = () => { />
- {!!sourceId && ( + {(unifiedReplication || !!sourceId) && (