-- Generic menu tables storage (Seminar, Publikasi, Penelitian, Aktivitas Pembelajaran)
CREATE TABLE IF NOT EXISTS generic_menu_tables (
  id INT AUTO_INCREMENT PRIMARY KEY,
  user_id INT NOT NULL,
  table_key VARCHAR(50) NOT NULL,
  rows_json LONGTEXT NOT NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  UNIQUE KEY uq_generic_menu_user_table (user_id, table_key),
  INDEX idx_generic_menu_user (user_id),
  CONSTRAINT fk_generic_menu_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;