Files
mailflare/drizzle/migrations/0054_add_push_subscriptions.sql
Hieu Nguyen (Jack)andClaude Sonnet 5.5 c8795ae39e Merge main into feat/pwa-web-push
Resolve conflicts in favor of main; re-apply Web Push on top.
Renumber push_subscriptions migration 0032 -> 0054 (0032 now taken).
Skip push for agent_draft notifications.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-07 16:27:13 +07:00

19 lines
782 B
SQL

CREATE TABLE `push_subscriptions` (
`id` text PRIMARY KEY NOT NULL,
`user_id` text NOT NULL,
`session_id` text NOT NULL,
`endpoint` text NOT NULL,
`p256dh` text NOT NULL,
`auth` text NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE UNIQUE INDEX `push_subscriptions_endpoint_idx` ON `push_subscriptions` (`endpoint`);
--> statement-breakpoint
CREATE INDEX `push_subscriptions_user_idx` ON `push_subscriptions` (`user_id`);
--> statement-breakpoint
CREATE INDEX `push_subscriptions_session_idx` ON `push_subscriptions` (`session_id`);