Skip to content

Commit fcd5353

Browse files
jasoncrawfordclaude
andcommitted
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 <noreply@anthropic.com>
1 parent 923a5c9 commit fcd5353

2 files changed

Lines changed: 77 additions & 2 deletions

File tree

‎supabase/config.toml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ enabled = false
2929
port = 54322
3030
# Port used by db diff command to initialize the shadow database.
3131
shadow_port = 54320
32-
# Maximum amount of time to wait for health check when starting the local database.
33-
health_timeout = "2m"
3432
# The database major version to use. This has to be the same as your remote database's. Run `SHOW
3533
# server_version;` on the remote database to check.
3634
major_version = 17

‎supabase/seed.sql‎

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
-- Seed data for Supabase branch databases (preview deploys)
2+
-- This file runs automatically when a branch DB is created via Supabase Branching.
3+
4+
-- ============================================================================
5+
-- Test auth user: test@example.com / test00
6+
-- ============================================================================
7+
8+
INSERT INTO auth.users (
9+
id,
10+
instance_id,
11+
aud,
12+
role,
13+
email,
14+
encrypted_password,
15+
email_confirmed_at,
16+
last_sign_in_at,
17+
raw_app_meta_data,
18+
raw_user_meta_data,
19+
created_at,
20+
updated_at,
21+
confirmation_token,
22+
email_change,
23+
email_change_token_new,
24+
recovery_token
25+
) VALUES (
26+
'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
27+
'00000000-0000-0000-0000-000000000000',
28+
'authenticated',
29+
'authenticated',
30+
'test@example.com',
31+
extensions.crypt('test00', extensions.gen_salt('bf')),
32+
now(),
33+
now(),
34+
'{"provider": "email", "providers": ["email"]}',
35+
'{}',
36+
now(),
37+
now(),
38+
'',
39+
'',
40+
'',
41+
''
42+
);
43+
44+
INSERT INTO auth.identities (
45+
id,
46+
user_id,
47+
identity_data,
48+
provider,
49+
provider_id,
50+
last_sign_in_at,
51+
created_at,
52+
updated_at
53+
) VALUES (
54+
'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
55+
'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
56+
'{"sub": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "email": "test@example.com"}',
57+
'email',
58+
'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
59+
now(),
60+
now(),
61+
now()
62+
);
63+
64+
-- ============================================================================
65+
-- Sample sites
66+
-- ============================================================================
67+
68+
INSERT INTO sites (id, name, url) VALUES
69+
('11111111-1111-1111-1111-111111111111', 'Example Site', 'https://example.com'),
70+
('22222222-2222-2222-2222-222222222222', 'Anthropic', 'https://www.anthropic.com');
71+
72+
-- ============================================================================
73+
-- Test contact
74+
-- ============================================================================
75+
76+
INSERT INTO contacts (email) VALUES
77+
('test@example.com');

0 commit comments

Comments
 (0)