-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate-test-users.sql
More file actions
92 lines (88 loc) · 1.89 KB
/
create-test-users.sql
File metadata and controls
92 lines (88 loc) · 1.89 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
-- Test Users Creation Script
-- Run this in your Supabase SQL Editor or via psql
-- Create a test student user
INSERT INTO users (
email,
username,
name,
role,
department,
phone,
email_verified,
is_active
) VALUES (
'student.test@iiitkottayam.ac.in',
'teststudent',
'Test Student',
'student',
'Computer Science',
'+91-9876543210',
true,
true
) ON CONFLICT (email) DO UPDATE SET
username = EXCLUDED.username,
name = EXCLUDED.name,
role = EXCLUDED.role,
department = EXCLUDED.department,
phone = EXCLUDED.phone,
email_verified = EXCLUDED.email_verified,
is_active = EXCLUDED.is_active;
-- Create a test teacher user
INSERT INTO users (
email,
username,
name,
role,
department,
phone,
email_verified,
is_active
) VALUES (
'teacher.test@iiitkottayam.ac.in',
'testteacher',
'Dr. Test Teacher',
'teacher',
'Computer Science',
'+91-9876543211',
true,
true
) ON CONFLICT (email) DO UPDATE SET
username = EXCLUDED.username,
name = EXCLUDED.name,
role = EXCLUDED.role,
department = EXCLUDED.department,
phone = EXCLUDED.phone,
email_verified = EXCLUDED.email_verified,
is_active = EXCLUDED.is_active;
-- Create an admin user for testing
INSERT INTO users (
email,
username,
name,
role,
department,
phone,
email_verified,
is_active
) VALUES (
'admin.test@iiitkottayam.ac.in',
'testadmin',
'Test Admin',
'admin',
'Administration',
'+91-9876543212',
true,
true
) ON CONFLICT (email) DO UPDATE SET
username = EXCLUDED.username,
name = EXCLUDED.name,
role = EXCLUDED.role,
department = EXCLUDED.department,
phone = EXCLUDED.phone,
email_verified = EXCLUDED.email_verified,
is_active = EXCLUDED.is_active;
-- Verify the users were created
SELECT id, email, username, name, role, department, email_verified, is_active, created_at
FROM users
WHERE email LIKE '%.test@iiitkottayam.ac.in'
ORDER BY role, email;