Skip to content

Migration 20250822140000 fails: text[] && user_role[] operator missing #307

@pixelsama

Description

@pixelsama

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions
  • I have searched for existing issues
  • I confirm that I am using English to submit this report
  • Please do not modify this template and fill in all the required fields

AgentifUI Version

main (commit fbcbe9f)

Environment

Local Development (pnpm dev)

Bug Description

Applying Supabase migrations with npx supabase db push fails on the notification RLS policy because target_roles is defined as text[] while profiles.role is the user_role enum. The policy uses text[] && user_role[], and Postgres errors out.

Steps to Reproduce

  1. Fresh checkout of main
  2. Run npx supabase db push against the project
  3. Migration 20250822140000_create_notifications_system.sql fails when creating the policy

✔️ Expected Behavior

The migration should apply cleanly and create notification policies.

❌ Actual Behavior

Migration stops with SQLSTATE 42883: operator does not exist: text[] && user_role[] in the policy "Users can read targeted published notifications".

Console Logs

ERROR: operator does not exist: text[] && user_role[] (SQLSTATE 42883)
At statement: (target_roles && ARRAY[(SELECT role FROM public.profiles WHERE id = auth.uid())])

Additional Context

Root cause: target_roles column is text[] but compared with profiles.role (user_role). Fix: change target_roles to user_role[] or cast role to text. I patched locally to user_role[] to match the enum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething is not working; user-visible defect.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions