-- Revert status field changes

-- Drop indexes
DROP INDEX IF EXISTS idx_sub_course_videos_status;
DROP INDEX IF EXISTS idx_practices_status;

-- Add back is_active to sub_course_videos
ALTER TABLE sub_course_videos 
ADD COLUMN IF NOT EXISTS is_active BOOLEAN NOT NULL DEFAULT TRUE;

-- Migrate data back
UPDATE sub_course_videos 
SET is_active = CASE 
    WHEN status IN ('PUBLISHED', 'DRAFT') THEN true
    ELSE false
END;

-- Drop status from sub_course_videos
ALTER TABLE sub_course_videos DROP COLUMN IF EXISTS status;

-- Add back is_active to practices
ALTER TABLE practices 
ADD COLUMN IF NOT EXISTS is_active BOOLEAN NOT NULL DEFAULT TRUE;

-- Migrate data back
UPDATE practices 
SET is_active = CASE 
    WHEN status IN ('PUBLISHED', 'DRAFT') THEN true
    ELSE false
END;

-- Drop status from practices
ALTER TABLE practices DROP COLUMN IF EXISTS status;
