© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
1 reply
Nin

Migrations fail without feedback

The migrations that work on my local DB aren't being pushed and I have no feedback as to why.

Below is the migration file it's currently erroring on:

CREATE OR REPLACE FUNCTION public.tid(
    )
    RETURNS uuid
    LANGUAGE 'sql'
    COST 100
    STABLE PARALLEL UNSAFE
AS $BODY$
select
      coalesce(
        (nullif(current_setting('request.jwt.claims', true), '')::jsonb #>> '{user_metadata, tenant_id}')
    )::uuid
$BODY$;

ALTER FUNCTION public.tid()
    OWNER TO supabase_auth_admin;

GRANT EXECUTE ON FUNCTION public.tid() TO PUBLIC;

GRANT EXECUTE ON FUNCTION public.tid() TO anon;

GRANT EXECUTE ON FUNCTION public.tid() TO authenticated;

GRANT EXECUTE ON FUNCTION public.tid() TO dashboard_user;

GRANT EXECUTE ON FUNCTION public.tid() TO service_role;

GRANT EXECUTE ON FUNCTION public.tid() TO supabase_auth_admin;

COMMENT ON FUNCTION public.tid()
    IS 'Returns the currently logged in users tenant id';
CREATE OR REPLACE FUNCTION public.tid(
    )
    RETURNS uuid
    LANGUAGE 'sql'
    COST 100
    STABLE PARALLEL UNSAFE
AS $BODY$
select
      coalesce(
        (nullif(current_setting('request.jwt.claims', true), '')::jsonb #>> '{user_metadata, tenant_id}')
    )::uuid
$BODY$;

ALTER FUNCTION public.tid()
    OWNER TO supabase_auth_admin;

GRANT EXECUTE ON FUNCTION public.tid() TO PUBLIC;

GRANT EXECUTE ON FUNCTION public.tid() TO anon;

GRANT EXECUTE ON FUNCTION public.tid() TO authenticated;

GRANT EXECUTE ON FUNCTION public.tid() TO dashboard_user;

GRANT EXECUTE ON FUNCTION public.tid() TO service_role;

GRANT EXECUTE ON FUNCTION public.tid() TO supabase_auth_admin;

COMMENT ON FUNCTION public.tid()
    IS 'Returns the currently logged in users tenant id';
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Use supabase locally without migrations?
SupabaseSSupabase / help-and-questions
4y ago
Branch migrations that depend on roles.sql fail.
SupabaseSSupabase / help-and-questions
6mo ago
Deleting records from supabase_migrations.schema_migrations achiev
SupabaseSSupabase / help-and-questions
5mo ago
Data Update Migrations
SupabaseSSupabase / help-and-questions
2w ago