From fcd53537d67360fee682fdecd7b79a134d30e9c9 Mon Sep 17 00:00:00 2001 From: Jason Crawford Date: Sat, 21 Feb 2026 20:31:38 -0800 Subject: [PATCH] feat: set up Supabase branching with seed data Add seed.sql to create test auth user and sample data for preview branches. Use extensions.crypt() for password hashing. Remove health_timeout from config.toml (unsupported by branching CLI). Configuration: GitHub integration "Supabase directory" must be set to "." (not "supabase") for correct seed path resolution. Test credentials: test@example.com / test00 Co-Authored-By: Claude Opus 4.6 --- supabase/config.toml | 2 -- supabase/seed.sql | 77 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 supabase/seed.sql diff --git a/supabase/config.toml b/supabase/config.toml index 06ce3ab..52e86f7 100644 --- a/supabase/config.toml +++ b/supabase/config.toml @@ -29,8 +29,6 @@ enabled = false port = 54322 # Port used by db diff command to initialize the shadow database. shadow_port = 54320 -# Maximum amount of time to wait for health check when starting the local database. -health_timeout = "2m" # The database major version to use. This has to be the same as your remote database's. Run `SHOW # server_version;` on the remote database to check. major_version = 17 diff --git a/supabase/seed.sql b/supabase/seed.sql new file mode 100644 index 0000000..4c4d843 --- /dev/null +++ b/supabase/seed.sql @@ -0,0 +1,77 @@ +-- Seed data for Supabase branch databases (preview deploys) +-- This file runs automatically when a branch DB is created via Supabase Branching. + +-- ============================================================================ +-- Test auth user: test@example.com / test00 +-- ============================================================================ + +INSERT INTO auth.users ( + id, + instance_id, + aud, + role, + email, + encrypted_password, + email_confirmed_at, + last_sign_in_at, + raw_app_meta_data, + raw_user_meta_data, + created_at, + updated_at, + confirmation_token, + email_change, + email_change_token_new, + recovery_token +) VALUES ( + 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + '00000000-0000-0000-0000-000000000000', + 'authenticated', + 'authenticated', + 'test@example.com', + extensions.crypt('test00', extensions.gen_salt('bf')), + now(), + now(), + '{"provider": "email", "providers": ["email"]}', + '{}', + now(), + now(), + '', + '', + '', + '' +); + +INSERT INTO auth.identities ( + id, + user_id, + identity_data, + provider, + provider_id, + last_sign_in_at, + created_at, + updated_at +) VALUES ( + 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + '{"sub": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "email": "test@example.com"}', + 'email', + 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + now(), + now(), + now() +); + +-- ============================================================================ +-- Sample sites +-- ============================================================================ + +INSERT INTO sites (id, name, url) VALUES + ('11111111-1111-1111-1111-111111111111', 'Example Site', 'https://example.com'), + ('22222222-2222-2222-2222-222222222222', 'Anthropic', 'https://www.anthropic.com'); + +-- ============================================================================ +-- Test contact +-- ============================================================================ + +INSERT INTO contacts (email) VALUES + ('test@example.com');