-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-admin.sql
More file actions
52 lines (47 loc) · 2.07 KB
/
create-admin.sql
File metadata and controls
52 lines (47 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
-- Create admin user script for production
-- This will be run manually through Supabase dashboard or psql
-- First, add some basic categories
INSERT INTO public.categories (name, description) VALUES
('Fashion', 'Clothing and fashion accessories'),
('Electronics', 'Electronic devices and gadgets'),
('Home & Garden', 'Home decor and garden supplies'),
('Sports', 'Sports equipment and fitness gear'),
('Books', 'Books and educational materials')
ON CONFLICT DO NOTHING;
-- Create a sample product
INSERT INTO public.products (
name,
description,
price,
inventory_count,
is_featured,
category_id,
image_url
) VALUES (
'Sample Product',
'This is a sample product to test the store functionality. A beautiful example item showcasing the Israeli e-commerce platform capabilities.',
29.99,
100,
true,
(SELECT id FROM public.categories WHERE name = 'Fashion' LIMIT 1),
'https://picsum.photos/400/400?random=1'
);
-- Create additional sample products
INSERT INTO public.products (
name,
description,
price,
inventory_count,
is_featured,
category_id,
image_url
) VALUES
('Premium Electronics Device', 'High-quality electronic device with advanced features', 199.99, 50, true, (SELECT id FROM public.categories WHERE name = 'Electronics' LIMIT 1), 'https://picsum.photos/400/400?random=2'),
('Home Decor Item', 'Beautiful home decoration piece to enhance your living space', 49.99, 75, false, (SELECT id FROM public.categories WHERE name = 'Home & Garden' LIMIT 1), 'https://picsum.photos/400/400?random=3'),
('Sports Equipment', 'Professional sports equipment for active lifestyle', 89.99, 30, true, (SELECT id FROM public.categories WHERE name = 'Sports' LIMIT 1), 'https://picsum.photos/400/400?random=4');
-- Note: Admin user creation must be done through Supabase Auth
-- You can create an admin user by:
-- 1. Going to your Supabase Dashboard > Authentication > Users
-- 2. Creating a new user with email and password
-- 3. Then updating their role with this query:
-- UPDATE public.users SET role = 'admin' WHERE email = 'your-admin-email@example.com';