diff --git a/supabase/migrations/20260716090000_profiles_username.sql b/supabase/migrations/20260716090000_profiles_username.sql index 4cd7f88..2e2879e 100644 --- a/supabase/migrations/20260716090000_profiles_username.sql +++ b/supabase/migrations/20260716090000_profiles_username.sql @@ -21,7 +21,7 @@ begin base := lower(regexp_replace(r.name, '\s+', '.', 'g')); base := regexp_replace(base, '[^a-z0-9._-]', '', 'g'); base := substring(base from 1 for 30); - if base = '' then + if length(base) < 3 then base := 'user' || substring(r.id::text from 1 for 8); end if; @@ -60,7 +60,7 @@ begin base := lower(regexp_replace(coalesce(new.raw_user_meta_data ->> 'name', new.email), '\s+', '.', 'g')); base := regexp_replace(base, '[^a-z0-9._-]', '', 'g'); base := substring(base from 1 for 30); - if base = '' then + if length(base) < 3 then base := 'user' || substring(new.id::text from 1 for 8); end if;