XataX
Xata16mo ago
Kramer

ERROR: permission denied for schema public

Hey! I was trying to deploy an Elixir - Phoenix application (Xata Direct Connection Beta) and I'm getting an error when running migrations. I'm using the Oban job library and it has a migration to setup the job table which runs the following SQL:

    DO $$
    BEGIN
    IF NOT EXISTS (SELECT 1 FROM pg_type
                   WHERE typname = 'oban_job_state'
                     AND typnamespace = 'public'::regnamespace::oid) THEN
        CREATE TYPE public.oban_job_state AS ENUM (
          'available',
          'scheduled',
          'executing',
          'retryable',
          'completed',
          'discarded'
        );
      END IF;
    END$$;


I get the following error:

Query 1 ERROR at Line 1: : ERROR:  permission denied for schema public
CONTEXT:  SQL statement "CREATE TYPE public.oban_job_state AS ENUM (
          'available',
          'scheduled',
          'executing',
          'retryable',
          'completed',
          'discarded'
        )"
PL/pgSQL function inline_code_block line 6 at SQL statement


I looked around the docs & limitations but could not figure out why this errors? I upgraded to Pro and provisioned a dedicated cluster thinking maybe it was because functions are only supported on a dedicated cluster, but I get the same error. Thanks in advance for your help!
GitHub
💎 Robust job processing in Elixir, backed by modern PostgreSQL and SQLite3 - oban-bg/oban
Was this page helpful?