Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions apps/docs/content/guides/deployment/managing-environments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -191,7 +190,7 @@ export const Destinations = () => {
/>
</div>
<div className="flex items-center gap-x-2">
{!!sourceId && (
{(unifiedReplication || !!sourceId) && (
<Button
type="default"
icon={<Plus />}
Expand Down
Loading