forked from AnitusA/Class_management_system
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple-test.js
More file actions
56 lines (45 loc) · 1.33 KB
/
Copy pathsimple-test.js
File metadata and controls
56 lines (45 loc) · 1.33 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
import { createClient } from '@supabase/supabase-js';
import dotenv from 'dotenv';
dotenv.config();
const supabaseUrl = process.env.SUPABASE_URL;
const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
const supabase = createClient(supabaseUrl, supabaseServiceRoleKey, {
auth: {
autoRefreshToken: false,
persistSession: false
}
});
async function simpleTest() {
console.log('🧪 Simple profile update test...');
try {
// Get first student
const { data: students, error } = await supabase
.from('students')
.select('*')
.limit(1);
if (error) {
console.error('❌ Error fetching:', error);
return;
}
const student = students[0];
console.log('✅ Found student:', student.register_number);
console.log('Current columns:', Object.keys(student));
// Try a simple update
const { data: result, error: updateError } = await supabase
.from('students')
.update({
name: 'TEST UPDATE',
updated_at: new Date().toISOString()
})
.eq('register_number', student.register_number)
.select();
if (updateError) {
console.error('❌ Update failed:', updateError);
} else {
console.log('✅ Update successful:', result);
}
} catch (err) {
console.error('❌ Error:', err);
}
}
simpleTest();