-- Create push_subscriptions table in Supabase
-- Run this in Supabase SQL Editor

create table public.push_subscriptions (
  id serial not null,
  user_id integer not null,
  endpoint text not null,
  auth_key text not null,
  p256dh_key text not null,
  created_at timestamp with time zone null default now(),
  constraint push_subscriptions_pkey primary key (id),
  constraint fk_push_subscriptions_user foreign key (user_id) references public.users (user_id) on delete cascade
) TABLESPACE pg_default;

create index IF not exists idx_push_subscriptions_user_id on public.push_subscriptions using btree (user_id) TABLESPACE pg_default;
create index IF not exists idx_push_subscriptions_endpoint on public.push_subscriptions using btree (endpoint) TABLESPACE pg_default;
