Import from Supabase.

Bring Supabase users across from one COPY statement against your project's database.

Run this statement against your project’s database, with psql and the connection string from the dashboard:

Shell
psql "$SUPABASE_DB_URL" -c "COPY (
  SELECT
    u.id,
    u.email,
    u.encrypted_password,
    u.email_confirmed_at,
    u.created_at,
    u.banned_until,
    u.deleted_at,
    coalesce(
      (SELECT json_agg(json_build_object('provider', i.provider, 'provider_id', i.provider_id)
                       ORDER BY i.provider, i.provider_id)
         FROM auth.identities i
        WHERE i.user_id = u.id AND i.provider <> 'email'),
      '[]') AS identities
  FROM auth.users u
  ORDER BY u.id
) TO STDOUT WITH (FORMAT csv, HEADER)" > supabase-users.csv

The statement is also authexport.SupabaseCopy.

  • Each user keeps the UUID from auth.users.
  • The address is verified when email_confirmed_at is set.
  • A bcrypt encrypted_password comes across.
  • An identity with the provider google becomes a Google identity, and github a GitHub identity.
  • A user whose banned_until is after the import is skipped as blocked, and a user with deleted_at as deleted.
  • Multi-factor factors in auth.mfa_factors stay behind. Those people enroll again.