-- Phase 25.5c migration: multi-device sync/provisioning metadata. ALTER TABLE devices ADD COLUMN IF NOT EXISTS last_config_sync_at TIMESTAMPTZ; ALTER TABLE devices ADD COLUMN IF NOT EXISTS last_config_sync_version INTEGER; ALTER TABLE devices ADD COLUMN IF NOT EXISTS force_sync_requested_at TIMESTAMPTZ; ALTER TABLE devices ADD COLUMN IF NOT EXISTS api_key_rotated_at TIMESTAMPTZ; UPDATE devices SET api_key_rotated_at = COALESCE(api_key_rotated_at, created_at) WHERE api_key_rotated_at IS NULL;