forked from AnitusA/Class_management_system
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-database.js
More file actions
44 lines (36 loc) · 1.55 KB
/
Copy pathcheck-database.js
File metadata and controls
44 lines (36 loc) · 1.55 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
// This script adds the completed_by_student column to assignments and records tables
// Run this from the browser console on a page that has Supabase access
// Add column to assignments table
async function addCompletedByStudentColumns() {
try {
console.log('Adding completed_by_student column to assignments table...');
// First check if assignments table exists and what columns it has
const { data: assignments, error: assignmentsError } = await supabase
.from('assignments')
.select('*')
.limit(1);
if (assignmentsError) {
console.error('Assignments table error:', assignmentsError);
} else {
console.log('Assignments table sample:', assignments);
}
// Check if records table exists and what columns it has
const { data: records, error: recordsError } = await supabase
.from('records')
.select('*')
.limit(1);
if (recordsError) {
console.error('Records table error:', recordsError);
} else {
console.log('Records table sample:', records);
}
console.log('If the completed_by_student column is missing, you need to run the SQL migration manually in Supabase.');
console.log('SQL to run:');
console.log('ALTER TABLE assignments ADD COLUMN IF NOT EXISTS completed_by_student BOOLEAN DEFAULT FALSE;');
console.log('ALTER TABLE records ADD COLUMN IF NOT EXISTS completed_by_student BOOLEAN DEFAULT FALSE;');
} catch (error) {
console.error('Error checking tables:', error);
}
}
// Run the function
addCompletedByStudentColumns();