Files
glass/supabase/migrations/002_push_subscriptions.sql
T
houseassassin af9e7ce1af feat: push notifications, calendar view, photo attachments
- Push notifications: custom SW (injectManifest), usePushNotifications hook,
  push-notify Edge Function, push_subscriptions migration, bell toggle in header
- Calendar view: month-grid CalendarPage + useCalendar hook, scheduled_at column
  migration, datetime field in OrderModal, CalendarDays nav item + route
- Photo attachments: useOrderPhotos hook, photo gallery/upload in OrderModal (edit
  mode), order-photos Storage bucket migration with RLS policies

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10 17:25:04 +03:00

19 lines
712 B
SQL

-- Push notification subscriptions
-- One row per user. The subscription JSONB holds the PushSubscription JSON
-- (endpoint, keys.p256dh, keys.auth) returned by the browser PushManager.
CREATE TABLE push_subscriptions (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,
subscription JSONB NOT NULL,
created_at TIMESTAMPTZ DEFAULT now(),
UNIQUE (user_id)
);
ALTER TABLE push_subscriptions ENABLE ROW LEVEL SECURITY;
-- Admins can only manage their own subscription
CREATE POLICY "Users manage own subscriptions"
ON push_subscriptions
USING (auth.uid() = user_id)
WITH CHECK (auth.uid() = user_id);