chore: add najva push notif service
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
-- Add 2FA fields to users table
|
||||
ALTER TABLE users
|
||||
ADD COLUMN is_2fa_enabled BOOLEAN DEFAULT FALSE NOT NULL,
|
||||
ADD COLUMN two_factor_enabled_at TIMESTAMPTZ DEFAULT NULL;
|
||||
|
||||
-- Create index on is_2fa_enabled for query performance
|
||||
CREATE INDEX idx_users_is_2fa_enabled ON users (is_2fa_enabled);
|
||||
@@ -1,23 +0,0 @@
|
||||
-- Add web push notification fields to users table
|
||||
ALTER TABLE users
|
||||
ADD COLUMN push_tokens JSONB DEFAULT NULL,
|
||||
ADD COLUMN push_notifications_enabled BOOLEAN DEFAULT true,
|
||||
ADD COLUMN last_push_notification_at TIMESTAMPTZ DEFAULT NULL;
|
||||
|
||||
-- Add indexes for better performance
|
||||
CREATE INDEX IF NOT EXISTS idx_users_push_notifications_enabled ON users (push_notifications_enabled)
|
||||
WHERE
|
||||
push_notifications_enabled = true
|
||||
AND deleted_at IS NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_users_push_tokens ON users USING GIN (push_tokens)
|
||||
WHERE
|
||||
push_tokens IS NOT NULL
|
||||
AND deleted_at IS NULL;
|
||||
|
||||
-- Add comment for documentation
|
||||
COMMENT ON COLUMN users.push_tokens IS 'JSON array of web push subscription objects containing endpoint and keys';
|
||||
|
||||
COMMENT ON COLUMN users.push_notifications_enabled IS 'Whether web push notifications are enabled for this user';
|
||||
|
||||
COMMENT ON COLUMN users.last_push_notification_at IS 'Timestamp of the last push notification sent to this user';
|
||||
Reference in New Issue
Block a user