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


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

then, when i pull with --schema auth,storage, alter the migrations file so that it will pull, and then run 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.
Was this page helpful?