[
  {
    "type": "raw_sql",
    "description": "Spec 049 review fix: normalize legacy breakComplianceLog NULL shiftId values to the repository's 0 sentinel before widening uk_idempotent.",
    "database": "{{store}}",
    "sql": "UPDATE `breakComplianceLog` SET `shiftId` = 0 WHERE `shiftId` IS NULL"
  },
  {
    "type": "raw_sql",
    "description": "Spec 049 review fix: include shiftId in breakComplianceLog uk_idempotent so same-day split shifts do not overwrite each other's compliance rows.",
    "database": "{{store}}",
    "check_query": "SELECT 1 FROM information_schema.statistics WHERE table_schema=DATABASE() AND table_name='breakComplianceLog' AND index_name='uk_idempotent' AND column_name='shiftId' LIMIT 1",
    "sql": "ALTER TABLE `breakComplianceLog` DROP INDEX `uk_idempotent`, ADD UNIQUE KEY `uk_idempotent` (`employeeId`, `shiftDate`, `shiftId`, `violationType`, `ruleId`, `punchId`)"
  }
]
