-- Fix disable_today column type from BIGINT to BOOLEAN
-- Migration script to update beach_places table

-- Step 1: Add new boolean column
ALTER TABLE beach_places ADD COLUMN disable_today_new BOOLEAN DEFAULT false;

-- Step 2: Update new column based on old column (0 = false, anything else = true)
UPDATE beach_places SET disable_today_new = CASE 
    WHEN disable_today = 0 THEN false 
    ELSE true 
END;

-- Step 3: Drop old column
ALTER TABLE beach_places DROP COLUMN disable_today;

-- Step 4: Rename new column to original name
ALTER TABLE beach_places RENAME COLUMN disable_today_new TO disable_today;

-- Add NOT NULL constraint
ALTER TABLE beach_places ALTER COLUMN disable_today SET NOT NULL;