[
  {
    "type": "alter_table",
    "description": "Add mobileClockInEnabled (master on/off for Team-app clock in/out) and geofenceEnabled (explicit on/off for on-site geofence enforcement, decoupled from whether coordinates are stored) to the stores table. latitude/longitude/geofenceRadius already exist (20251222_022_001).",
    "database": "kiosk_buykiosk",
    "check_query": "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'kiosk_buykiosk' AND TABLE_NAME = 'stores' AND COLUMN_NAME = 'mobileClockInEnabled'",
    "sql": "ALTER TABLE `stores`\n  ADD COLUMN `mobileClockInEnabled` TINYINT(1) NOT NULL DEFAULT 1 COMMENT 'Master toggle: allow employees to clock in/out via the mobile Team app',\n  ADD COLUMN `geofenceEnabled` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Require employees to be on-site (within geofenceRadius of latitude/longitude) to clock in via mobile'"
  },
  {
    "type": "update",
    "description": "Backfill geofenceEnabled = 1 for any store that already has coordinates set. Before this migration, geofence was enforced implicitly whenever latitude/longitude were populated; with the new explicit flag, those stores must keep enforcement on so they don't silently reopen off-site clock-in. Idempotent.",
    "database": "kiosk_buykiosk",
    "sql": "UPDATE `stores` SET `geofenceEnabled` = 1 WHERE `latitude` IS NOT NULL AND `longitude` IS NOT NULL AND `geofenceEnabled` = 0"
  }
]
