-- nav_panel_skeleton_v1.sql
-- Minimal schema for dynamic bottom navbar + roles/permissions example.
-- Compatible with MariaDB/MySQL.


CREATE TABLE IF NOT EXISTS user_permissions (
  id INT AUTO_INCREMENT PRIMARY KEY,
  user_id INT NOT NULL,
  perm_code VARCHAR(100) NOT NULL,
  UNIQUE KEY uq_user_perm (user_id, perm_code),
  CONSTRAINT fk_user_permissions_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Give admin settings permission
INSERT IGNORE INTO user_permissions (user_id, perm_code) VALUES
(1,'settings.manage');
