change seed
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 18s

This commit is contained in:
ordinarthur 2026-04-12 12:34:13 +02:00
parent ccc5cd4b78
commit 89ea85bbf8

View File

@ -4,11 +4,27 @@
-- Source: Hacker Public Radio (archive.org) -- Source: Hacker Public Radio (archive.org)
-- ============================================== -- ==============================================
-- 1. Create demo users (fake auth entries then profiles) -- 1. Create demo users in auth.users first (required for FK on profiles)
-- NOTE: Run this AFTER the migration 001_initial_schema.sql -- NOTE: Run this AFTER the migration 001_initial_schema.sql
-- Insert profiles directly (these won't have auth.users entries, INSERT INTO auth.users (id, instance_id, email, encrypted_password, email_confirmed_at, aud, role, raw_app_meta_data, raw_user_meta_data, created_at, updated_at, confirmation_token) VALUES
-- but work for display purposes) ('a1000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000000', 'ahuka@demo.wetalk.fr', crypt('demo-password-123', gen_salt('bf')), NOW(), 'authenticated', 'authenticated', '{"provider":"email","providers":["email"]}', '{"username":"ahuka"}', NOW(), NOW(), ''),
('a1000000-0000-0000-0000-000000000002', '00000000-0000-0000-0000-000000000000', 'sgoti@demo.wetalk.fr', crypt('demo-password-123', gen_salt('bf')), NOW(), 'authenticated', 'authenticated', '{"provider":"email","providers":["email"]}', '{"username":"sgoti"}', NOW(), NOW(), ''),
('a1000000-0000-0000-0000-000000000003', '00000000-0000-0000-0000-000000000000', 'klaatu@demo.wetalk.fr', crypt('demo-password-123', gen_salt('bf')), NOW(), 'authenticated', 'authenticated', '{"provider":"email","providers":["email"]}', '{"username":"klaatu"}', NOW(), NOW(), ''),
('a1000000-0000-0000-0000-000000000004', '00000000-0000-0000-0000-000000000000', 'windigo@demo.wetalk.fr', crypt('demo-password-123', gen_salt('bf')), NOW(), 'authenticated', 'authenticated', '{"provider":"email","providers":["email"]}', '{"username":"windigo"}', NOW(), NOW(), ''),
('a1000000-0000-0000-0000-000000000005', '00000000-0000-0000-0000-000000000000', 'corydoctorow@demo.wetalk.fr', crypt('demo-password-123', gen_salt('bf')), NOW(), 'authenticated', 'authenticated', '{"provider":"email","providers":["email"]}', '{"username":"corydoctorow"}', NOW(), NOW(), '')
ON CONFLICT (id) DO NOTHING;
-- Also insert into auth.identities (required by Supabase Auth)
INSERT INTO auth.identities (id, user_id, provider_id, provider, identity_data, last_sign_in_at, created_at, updated_at) VALUES
('a1000000-0000-0000-0000-000000000001', 'a1000000-0000-0000-0000-000000000001', 'a1000000-0000-0000-0000-000000000001', 'email', '{"sub":"a1000000-0000-0000-0000-000000000001","email":"ahuka@demo.wetalk.fr"}', NOW(), NOW(), NOW()),
('a1000000-0000-0000-0000-000000000002', 'a1000000-0000-0000-0000-000000000002', 'a1000000-0000-0000-0000-000000000002', 'email', '{"sub":"a1000000-0000-0000-0000-000000000002","email":"sgoti@demo.wetalk.fr"}', NOW(), NOW(), NOW()),
('a1000000-0000-0000-0000-000000000003', 'a1000000-0000-0000-0000-000000000003', 'a1000000-0000-0000-0000-000000000003', 'email', '{"sub":"a1000000-0000-0000-0000-000000000003","email":"klaatu@demo.wetalk.fr"}', NOW(), NOW(), NOW()),
('a1000000-0000-0000-0000-000000000004', 'a1000000-0000-0000-0000-000000000004', 'a1000000-0000-0000-0000-000000000004', 'email', '{"sub":"a1000000-0000-0000-0000-000000000004","email":"windigo@demo.wetalk.fr"}', NOW(), NOW(), NOW()),
('a1000000-0000-0000-0000-000000000005', 'a1000000-0000-0000-0000-000000000005', 'a1000000-0000-0000-0000-000000000005', 'email', '{"sub":"a1000000-0000-0000-0000-000000000005","email":"corydoctorow@demo.wetalk.fr"}', NOW(), NOW(), NOW())
ON CONFLICT (id) DO NOTHING;
-- Now insert profiles (the trigger handle_new_user won't fire on direct auth.users inserts)
INSERT INTO public.profiles (id, username, avatar_url, bio, is_premium, free_listens_count) VALUES INSERT INTO public.profiles (id, username, avatar_url, bio, is_premium, free_listens_count) VALUES
('a1000000-0000-0000-0000-000000000001', 'ahuka', NULL, 'Passionné de technologie et de logiciels libres. Contributeur Hacker Public Radio.', true, 0), ('a1000000-0000-0000-0000-000000000001', 'ahuka', NULL, 'Passionné de technologie et de logiciels libres. Contributeur Hacker Public Radio.', true, 0),
('a1000000-0000-0000-0000-000000000002', 'sgoti', NULL, 'Podcaster et bricoleur informatique. J''aime parler de tout et de rien.', false, 3), ('a1000000-0000-0000-0000-000000000002', 'sgoti', NULL, 'Podcaster et bricoleur informatique. J''aime parler de tout et de rien.', false, 3),