-- Migration 020: Store uptime_seconds as REAL for fractional values
-- Date: 2026-01-11
-- Description: Change hardware_snapshots.uptime_seconds from INTEGER to REAL

BEGIN TRANSACTION;

ALTER TABLE hardware_snapshots ADD COLUMN uptime_seconds_real REAL;
UPDATE hardware_snapshots
SET uptime_seconds_real = uptime_seconds
WHERE uptime_seconds IS NOT NULL;

ALTER TABLE hardware_snapshots DROP COLUMN uptime_seconds;
ALTER TABLE hardware_snapshots RENAME COLUMN uptime_seconds_real TO uptime_seconds;

COMMIT;
