-- Crea tabella sec_users se non esiste e inserisce/aggiorna utente admin
CREATE TABLE IF NOT EXISTS sec_users (
  id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  username VARCHAR(64) NOT NULL UNIQUE,
  password_hash VARCHAR(255) NOT NULL,
  active TINYINT(1) NOT NULL DEFAULT 1,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO sec_users (username, password_hash, active)
VALUES (admin, y/G3XJVzdax21CuMq8.uaGBG, 1)
ON DUPLICATE KEY UPDATE password_hash = VALUES(password_hash), active = 1;
