-- Add accidental_flag column to time_clocks table
-- This flag is used to mark time clock entries that need to be flagged as accidental
-- and will be visible in Payroll Daily Details until approved

ALTER TABLE time_clocks ADD COLUMN IF NOT EXISTS accidental_flag BOOLEAN DEFAULT false;

-- Add index for better performance when querying flagged entries
CREATE INDEX IF NOT EXISTS idx_time_clocks_accidental_flag 
ON time_clocks (accidental_flag, user_id) 
WHERE accidental_flag = true AND isDeleted = false;

-- Add comment for documentation
COMMENT ON COLUMN time_clocks.accidental_flag IS 'Flag to mark time clock entries as accidental, visible in Payroll Daily Details until approved';