forked from AnitusA/Class_management_system
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-event-insert.js
More file actions
33 lines (26 loc) Β· 1.1 KB
/
Copy pathtest-event-insert.js
File metadata and controls
33 lines (26 loc) Β· 1.1 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
import { createClient } from '@supabase/supabase-js';
// Initialize Supabase client with service role key
const supabaseUrl = 'https://spjnakucrrjvvdsahpom.supabase.co';
const supabaseServiceKey = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNwam5ha3VjcnJqdnZkc2FocG9tIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc1MjkwOTA4NSwiZXhwIjoyMDY4NDg1MDg1fQ.kJWcHkRz8NPuK-JfboT_Eiyqm_yMIPmQFm3kJG0PO6Y';
const supabase = createClient(supabaseUrl, supabaseServiceKey);
async function testEventInsert() {
console.log('π§ͺ Testing event insert with event_name...');
try {
const { data: newEvent, error } = await supabase
.from('events')
.insert({
event_name: 'Test Event'
})
.select();
if (error) {
console.log('β Error:', error.message);
} else {
console.log('β
Event created successfully!');
console.log('π Available columns:', Object.keys(newEvent[0]));
console.log('π Record:', newEvent[0]);
}
} catch (err) {
console.error('β Unexpected error:', err);
}
}
testEventInsert().catch(console.error);