-- Откат: удаляем новые колонки
ALTER TABLE fitbit_integrations DROP COLUMN IF EXISTS steps_task_id;
ALTER TABLE fitbit_integrations DROP COLUMN IF EXISTS floors_task_id;
ALTER TABLE fitbit_integrations DROP COLUMN IF EXISTS steps_goal_task_id;
ALTER TABLE fitbit_integrations DROP COLUMN IF EXISTS steps_goal_subtask_id;
ALTER TABLE fitbit_integrations DROP COLUMN IF EXISTS floors_goal_task_id;
ALTER TABLE fitbit_integrations DROP COLUMN IF EXISTS floors_goal_subtask_id;

ALTER TABLE fitbit_daily_stats DROP COLUMN IF EXISTS goal_steps;
ALTER TABLE fitbit_daily_stats DROP COLUMN IF EXISTS goal_floors;

-- Восстанавливаем старые колонки
ALTER TABLE fitbit_daily_stats ADD COLUMN active_zone_minutes INTEGER DEFAULT 0;

ALTER TABLE fitbit_integrations ADD COLUMN goal_steps_min INTEGER DEFAULT 8000;
ALTER TABLE fitbit_integrations ADD COLUMN goal_steps_max INTEGER DEFAULT 10000;
ALTER TABLE fitbit_integrations ADD COLUMN goal_floors_min INTEGER DEFAULT 8;
ALTER TABLE fitbit_integrations ADD COLUMN goal_floors_max INTEGER DEFAULT 10;
ALTER TABLE fitbit_integrations ADD COLUMN goal_azm_min INTEGER DEFAULT 22;
ALTER TABLE fitbit_integrations ADD COLUMN goal_azm_max INTEGER DEFAULT 44;
