-- user_page_permissions 테이블 (MariaDB)
-- 사용자별 페이지 접근 권한 관리

CREATE TABLE IF NOT EXISTS user_page_permissions (
    id INT AUTO_INCREMENT PRIMARY KEY,
    user_id INT NOT NULL,
    page_name VARCHAR(50) NOT NULL,
    can_access BOOLEAN DEFAULT FALSE,
    granted_by_id INT NULL,
    granted_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    notes TEXT NULL,
    UNIQUE KEY unique_user_page (user_id, page_name),
    FOREIGN KEY (user_id) REFERENCES sso_users(user_id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
