-- Migration 36: warranty_status_logs
-- Audit trail for every warranty status change.
-- Note: old_status/new_status accept any string (not an enum) so tests can
-- insert any transition without needing to maintain enum lists.

CREATE TABLE IF NOT EXISTS `warranty_status_logs` (
  `id`          int(10) unsigned NOT NULL AUTO_INCREMENT,
  `warranty_id` int(10) unsigned NOT NULL,
  `old_status`  varchar(30)      DEFAULT NULL,
  `new_status`  varchar(30)      NOT NULL,
  `changed_by`  int(10) unsigned NOT NULL COMMENT 'Admin ID',
  `note`        text             DEFAULT NULL,
  `created_at`  datetime         NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_warranty` (`warranty_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
