-- StudyTrack: Web Push Notifications
-- Run this SQL in your database to enable phone/browser push notifications

CREATE TABLE IF NOT EXISTS `push_subscriptions` (
    `id`         INT AUTO_INCREMENT PRIMARY KEY,
    `user_id`    INT NOT NULL,
    `endpoint`   TEXT NOT NULL,
    `p256dh`     TEXT,
    `auth_key`   TEXT,
    `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
    INDEX `idx_user`     (`user_id`),
    INDEX `idx_endpoint` (`endpoint`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
