Initial commit - Black Canyon Tickets whitelabel platform
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
16
supabase/functions/handle-auth-signup.sql
Normal file
16
supabase/functions/handle-auth-signup.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
-- Function to handle user signup and create user record
|
||||
CREATE OR REPLACE FUNCTION handle_auth_signup()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
-- Create user record in users table
|
||||
INSERT INTO users (id, email, name)
|
||||
VALUES (NEW.id, NEW.email, NEW.raw_user_meta_data->>'name');
|
||||
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql SECURITY DEFINER;
|
||||
|
||||
-- Trigger to run the function when a user signs up
|
||||
CREATE TRIGGER on_auth_user_created
|
||||
AFTER INSERT ON auth.users
|
||||
FOR EACH ROW EXECUTE FUNCTION handle_auth_signup();
|
||||
Reference in New Issue
Block a user