

CREATE TABLE IF NOT EXISTS activity (
  id INT AUTO_INCREMENT PRIMARY KEY,
  username VARCHAR(64) NOT NULL,
  etype VARCHAR(32) NOT NULL,           -- login / logout / project / render_start / render_done / factory / blocked_attempt
  title VARCHAR(255) NOT NULL DEFAULT '',
  detail VARCHAR(500) NOT NULL DEFAULT '',
  machine VARCHAR(128) NOT NULL DEFAULT '',
  ts DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  INDEX (username), INDEX (etype), INDEX (ts)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS html_files (
  id INT AUTO_INCREMENT PRIMARY KEY,
  username VARCHAR(64) NOT NULL,
  title VARCHAR(255) NOT NULL DEFAULT '',
  filename VARCHAR(255) NOT NULL,
  stored_as VARCHAR(255) NOT NULL,
  uploaded DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  INDEX (username)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
