[
  {
    "type": "create_table",
    "description": "Create qb_audit_log table for append-only QuickBooks operation tracking",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'qb_audit_log'",
    "sql": "CREATE TABLE `qb_audit_log` (\n  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n  `eventType` ENUM('sync_staged','sync_posted','sync_failed','edited','approved','rejected','voided','re_synced','mapping_updated','settings_changed','connected','disconnected') NOT NULL,\n  `syncDate` DATE NULL COMMENT 'Business date this event relates to',\n  `stagedEntryId` INT UNSIGNED NULL COMMENT 'FK to qb_staged_entries',\n  `actorId` INT UNSIGNED NULL COMMENT 'users.id',\n  `actorName` VARCHAR(100) NULL COMMENT 'Denormalized for export',\n  `details` JSON NULL COMMENT 'Event-specific payload',\n  `ipAddress` VARCHAR(45) NULL,\n  `createdAt` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  PRIMARY KEY (`id`),\n  INDEX `idx_event_type` (`eventType`),\n  INDEX `idx_sync_date` (`syncDate`),\n  INDEX `idx_created` (`createdAt`),\n  INDEX `idx_actor` (`actorId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Append-only audit log for all QuickBooks operations (Spec 048)'"
  }
]
