-- Pixmenia v20 safe update guard
-- This migration is additive only. It does not drop customer data.
CREATE TABLE IF NOT EXISTS asset_repair_logs (
  id INT AUTO_INCREMENT PRIMARY KEY,
  checked_count INT NOT NULL DEFAULT 0,
  fixed_count INT NOT NULL DEFAULT 0,
  missing_count INT NOT NULL DEFAULT 0,
  report_json LONGTEXT NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS system_update_warnings (
  id INT AUTO_INCREMENT PRIMARY KEY,
  warning_key VARCHAR(120) NOT NULL UNIQUE,
  warning_text TEXT NOT NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO system_update_warnings (warning_key, warning_text) VALUES
('do_not_overwrite_database','Do not import a full fresh database over production. It can delete customer images, invoices, credits, payment records and legal consent logs. Use migrations only or backup first.')
ON DUPLICATE KEY UPDATE warning_text=VALUES(warning_text);
