-- ClickDelivery V0.6 APK Integration

ALTER TABLE mobile_feature_flags
  ADD COLUMN IF NOT EXISTS realtime_websocket boolean NOT NULL DEFAULT true;

UPDATE mobile_feature_flags SET realtime_websocket=true WHERE realtime_websocket IS DISTINCT FROM true;

-- Corrige los package IDs provisionales V0.5 usando los AndroidManifest reales auditados.
UPDATE app_builds SET package_id='com.clickdelivery.administrador'
 WHERE package_id IN ('bo.clickdelivery.admin','com.clickdelivery.administrador.2');
UPDATE app_builds SET package_id='com.clickdelivery.comercio'
 WHERE package_id IN ('bo.clickdelivery.comercio','com.clickdelivery.comercio.7');
UPDATE app_builds SET package_id='com.clickdelivery.usuario'
 WHERE package_id IN ('bo.clickdelivery.delivery','com.clickdelivery.usuario.3');
UPDATE app_builds SET package_id='com.clickdelivery.repartidor'
 WHERE package_id IN ('bo.clickdelivery.repartidor','com.clickdelivery.repartidor.1');
