-- Subscription / license expiry for POS26
-- Run on existing databases. Default unlock passcode: POS26ADMIN

CREATE TABLE IF NOT EXISTS subscription_renewals (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  previous_expires_at DATE NULL,
  new_expires_at DATE NOT NULL,
  renewed_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  ip_address VARCHAR(45) NULL,
  user_agent VARCHAR(255) NULL,
  notes VARCHAR(255) NULL,
  PRIMARY KEY (id),
  KEY idx_renewed_at (renewed_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Note: default passcode hash above is for "POS26ADMIN" — change via direct DB update if needed.
