© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
1 reply
asleepdream

supabase db pull

hello,

i am having issues pulling my production database schema to my local supabase instance.

when i originally pull the schema:

Seeding globals from roles.sql...
Applying migration 20250107080821_remote_schema.sql...
Applying migration 20250109023135_remote_schema.sql...
Applying migration 20250120014743_remote_schema.sql...
Applying migration 20250120015606_remote_schema.sql...
Applying migration 20250120015721_remote_schema.sql...
Applying migration 20250122030752_remote_schema.sql...
ERROR: relation "users" does not exist (SQLSTATE 42P01)
At statement 11: alter table "public"."customers" add constraint "customers_id_fkey" FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE not valid
Seeding globals from roles.sql...
Applying migration 20250107080821_remote_schema.sql...
Applying migration 20250109023135_remote_schema.sql...
Applying migration 20250120014743_remote_schema.sql...
Applying migration 20250120015606_remote_schema.sql...
Applying migration 20250120015721_remote_schema.sql...
Applying migration 20250122030752_remote_schema.sql...
ERROR: relation "users" does not exist (SQLSTATE 42P01)
At statement 11: alter table "public"."customers" add constraint "customers_id_fkey" FOREIGN KEY (id) REFERENCES users(id) ON DELETE CASCADE not valid


this needs to be manually fixed by altering
users(id)
users(id)
to
auth.users(id)
auth.users(id)
to work

then, when i pull with
--schema auth,storage
--schema auth,storage
, alter the migrations file so that it will pull, and then run
supabase db reset
supabase db reset
, i get

Resetting local database...
Recreating database...
Setting up initial schema...
Seeding globals from roles.sql...
Applying migration 20250107080821_remote_schema.sql...
Applying migration 20250109023135_remote_schema.sql...
Applying migration 20250120014743_remote_schema.sql...
Applying migration 20250120015606_remote_schema.sql...
Applying migration 20250120015721_remote_schema.sql...
Applying migration 20250122030752_remote_schema.sql...
Applying migration 20250122030935_remote_schema.sql...
ERROR: type "code_challenge_method" does not exist (SQLSTATE 42704)
At statement 11: alter table "auth"."flow_state" alter column "code_challenge_method" set data type code_challenge_method using "code_challenge_method"::text::code_challenge_method
Try rerunning the command with --debug to troubleshoot the error.
Resetting local database...
Recreating database...
Setting up initial schema...
Seeding globals from roles.sql...
Applying migration 20250107080821_remote_schema.sql...
Applying migration 20250109023135_remote_schema.sql...
Applying migration 20250120014743_remote_schema.sql...
Applying migration 20250120015606_remote_schema.sql...
Applying migration 20250120015721_remote_schema.sql...
Applying migration 20250122030752_remote_schema.sql...
Applying migration 20250122030935_remote_schema.sql...
ERROR: type "code_challenge_method" does not exist (SQLSTATE 42704)
At statement 11: alter table "auth"."flow_state" alter column "code_challenge_method" set data type code_challenge_method using "code_challenge_method"::text::code_challenge_method
Try rerunning the command with --debug to troubleshoot the error.
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

supabase db pull
SupabaseSSupabase / help-and-questions
3y ago
Supabase db pull, cast error
SupabaseSSupabase / help-and-questions
5mo ago
Trying db pull on supabase
SupabaseSSupabase / help-and-questions
12mo ago
Has the `supabase db pull` changed?
SupabaseSSupabase / help-and-questions
6mo ago