mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 08:11:13 -05:00
Fix email change token schema
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
-- Fix all email change token columns to use empty strings instead of NULL
|
||||||
|
-- This addresses Supabase Auth scanner issues with NULL string columns
|
||||||
|
|
||||||
|
-- Create a function to update all NULL token values to empty strings
|
||||||
|
CREATE OR REPLACE FUNCTION public.fix_auth_email_tokens()
|
||||||
|
RETURNS void
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
SECURITY DEFINER
|
||||||
|
SET search_path TO 'auth', 'public'
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
-- Update all NULL email change token values to empty strings
|
||||||
|
UPDATE auth.users
|
||||||
|
SET
|
||||||
|
email_change_token_current = COALESCE(email_change_token_current, ''),
|
||||||
|
email_change_token_new = COALESCE(email_change_token_new, '')
|
||||||
|
WHERE email_change_token_current IS NULL
|
||||||
|
OR email_change_token_new IS NULL;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
-- Execute the fix
|
||||||
|
SELECT public.fix_auth_email_tokens();
|
||||||
|
|
||||||
|
-- Drop the temporary function
|
||||||
|
DROP FUNCTION public.fix_auth_email_tokens();
|
||||||
Reference in New Issue
Block a user