-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclear_shift_data.sql
More file actions
40 lines (32 loc) · 1.31 KB
/
Copy pathclear_shift_data.sql
File metadata and controls
40 lines (32 loc) · 1.31 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
-- Clear all shift and attendance data to start fresh
-- This will delete ALL shifts and attendance records but keep people/employees
-- OPTION 1: Delete EVERYTHING (all months)
-- Uncomment these lines to delete all data:
-- DELETE FROM attendance_events;
-- DELETE FROM attendance_days;
-- DELETE FROM shifts;
-- OPTION 2: Delete only November 2025 data (recommended)
-- This keeps your older data intact
-- Delete attendance events for November 2025
DELETE FROM attendance_events
WHERE occurred_at >= '2025-11-01' AND occurred_at < '2025-12-01';
-- Delete attendance days for November 2025
DELETE FROM attendance_days
WHERE date >= '2025-11-01' AND date < '2025-12-01';
-- Delete shifts for November 2025
DELETE FROM shifts
WHERE date >= '2025-11-01' AND date < '2025-12-01';
-- Verify deletion
SELECT 'Attendance Days Remaining' as table_name, COUNT(*) as count FROM attendance_days
UNION ALL
SELECT 'Shifts Remaining', COUNT(*) FROM shifts
UNION ALL
SELECT 'Attendance Events Remaining', COUNT(*) FROM attendance_events;
-- Show remaining November data (should be 0 for Option 2)
SELECT 'November Attendance Days' as table_name, COUNT(*) as count
FROM attendance_days
WHERE date >= '2025-11-01' AND date < '2025-12-01'
UNION ALL
SELECT 'November Shifts', COUNT(*)
FROM shifts
WHERE date >= '2025-11-01' AND date < '2025-12-01';