CREATE TABLE IF NOT EXISTS gi_awin_import_jobs (
  job_id VARCHAR(40) PRIMARY KEY,
  run_id VARCHAR(40) NOT NULL,
  file_path VARCHAR(500) NOT NULL,
  file_size BIGINT UNSIGNED NOT NULL DEFAULT 0,
  file_mtime BIGINT UNSIGNED NOT NULL DEFAULT 0,
  status VARCHAR(20) NOT NULL DEFAULT 'pending',
  byte_offset BIGINT UNSIGNED NOT NULL DEFAULT 0,
  rows_processed INT UNSIGNED NOT NULL DEFAULT 0,
  seen_count INT UNSIGNED NOT NULL DEFAULT 0,
  created_count INT UNSIGNED NOT NULL DEFAULT 0,
  merged_count INT UNSIGNED NOT NULL DEFAULT 0,
  error_count INT UNSIGNED NOT NULL DEFAULT 0,
  error TEXT NULL,
  started_at DATETIME NOT NULL,
  updated_at DATETIME NOT NULL,
  finished_at DATETIME NULL,
  KEY gi_awin_job_status(status,started_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
