Skip to content

fix(dashboard): preserve rls policies on tenant migrations fix plan#1898

Merged
leandrocp merged 1 commit into
mainfrom
fix/lp-tenant-mig-keep-rls
May 20, 2026
Merged

fix(dashboard): preserve rls policies on tenant migrations fix plan#1898
leandrocp merged 1 commit into
mainfrom
fix/lp-tenant-mig-keep-rls

Conversation

@leandrocp

Copy link
Copy Markdown
Contributor

Add a filter in pgdelta to preserve RLS policies in the realtime schema.

This is important to let Tenant Migrations fix schemas without dropping existing RLS.

For eg a schema with missing messages_inserted_at_topic_index and existing RLS policies in realtime.messages without pgdelta filter does create a plan like:

-- Risk: safe
DROP POLICY "authenticated broadcast on topic" ON realtime.messages;

DROP POLICY "authenticated receive on topic" ON realtime.messages;

CREATE INDEX messages_inserted_at_topic_index ON realtime.messages
(inserted_at DESC, topic) WHERE extension = 'broadcast'::text AND
private IS TRUE;

With the new filter only the CREATE INDEX in included in the plan.

Add a filter in pgdelta to preserve RLS policies in the realtime schema.

This is important to let Tenant Migrations fix schemas without dropping
existing RLS.

For eg a schema with missing `messages_inserted_at_topic_index` and
existing RLS policies in `realtime.messages` without pgdelta filter does
create a plan like:

```sql
-- Risk: safe
DROP POLICY "authenticated broadcast on topic" ON realtime.messages;

DROP POLICY "authenticated receive on topic" ON realtime.messages;

CREATE INDEX messages_inserted_at_topic_index ON realtime.messages
(inserted_at DESC, topic) WHERE extension = 'broadcast'::text AND
private IS TRUE;
```
@leandrocp leandrocp changed the title fix(dashboard): keep rls policies on tenant migrations page fix(dashboard): preserve rls policies on tenant migrations fix plan May 20, 2026
@leandrocp leandrocp merged commit fc6fbd8 into main May 20, 2026
35 of 37 checks passed
@leandrocp leandrocp deleted the fix/lp-tenant-mig-keep-rls branch May 20, 2026 20:56
@realtime-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 2.97.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 91.345% (-0.09%) from 91.43% — fix/lp-tenant-mig-keep-rls into main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants