Creating comprehensive seed scripts for Supabase to populate your local database with realistic test data.
SpaceZero ships no seed script. The only database artifact is the migration supabase/migrations/00001_spacezero_core.sql, which creates two tables: user_profiles and app_entitlements (plus RLS policies and the public avatars storage bucket). docs/seed.md is a product specification template, not a SQL seed file.
There is no supabase auth sign-up command. Create test users in the Supabase Dashboard (Authentication → Users → Add user), or via the Admin API:
await supabase.auth.admin.createUser({
email: '[email protected]',
password: 'test-password-1',
email_confirm: true,
});
The Supabase CLI runs supabase/seed.sql automatically after supabase db reset if the file exists. To seed profiles and entitlements for your test users:
-- supabase/seed.sql
-- Run with: supabase db reset (replays migrations + this file)
-- User profiles for test accounts
INSERT INTO user_profiles (id, email, full_name, avatar_url, newsletter_subscribed, created_at, updated_at)
SELECT
id, email, 'Test User ' || ROW_NUMBER() OVER (), null, false, NOW(), NOW()
FROM auth.users
WHERE email LIKE 'test%@example.com'
ON CONFLICT (id) DO UPDATE SET
full_name = EXCLUDED.full_name,
updated_at = NOW();
-- Entitlements (for Gumroad testing)
INSERT INTO app_entitlements (gumroad_sale_id, email, user_id, product_id, status, metadata, updated_at)
SELECT
'test_sale_' || ROW_NUMBER() OVER (),
email,
id,
'test_product',
'active',
'{}'::jsonb,
NOW()
FROM auth.users
WHERE email LIKE 'test%@example.com'
ON CONFLICT (gumroad_sale_id) DO NOTHING;
# Replay all migrations (and supabase/seed.sql if present)
supabase db reset
# Or apply migrations without the seed
supabase migration up
For larger datasets, generate SQL with a script (Faker.js or plain TypeScript) and commit the output as supabase/seed.sql. Keep production seeds minimal — reference data only.
# .github/workflows/test.yml
- name: Setup Supabase
uses: supabase/setup-cli@v1
- name: Start Supabase
run: supabase start
- name: Run Migrations
run: supabase db reset
- name: Run Tests
run: npm test