CREATE TABLE "notification" ( "id" text PRIMARY KEY NOT NULL, "user_id" text NOT NULL, "type" text NOT NULL, "title" text NOT NULL, "message" text NOT NULL, "data" jsonb, "is_read" boolean DEFAULT false, "created_at" timestamp with time zone DEFAULT now() NOT NULL ); --> statement-breakpoint CREATE TABLE "notification_preferences" ( "user_id" text PRIMARY KEY NOT NULL, "friend_requests" boolean DEFAULT true, "friend_accepted" boolean DEFAULT true, "find_liked" boolean DEFAULT true, "find_commented" boolean DEFAULT true, "push_enabled" boolean DEFAULT true, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone DEFAULT now() NOT NULL ); --> statement-breakpoint CREATE TABLE "notification_subscription" ( "id" text PRIMARY KEY NOT NULL, "user_id" text NOT NULL, "endpoint" text NOT NULL, "p256dh_key" text NOT NULL, "auth_key" text NOT NULL, "user_agent" text, "is_active" boolean DEFAULT true, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone DEFAULT now() NOT NULL ); --> statement-breakpoint ALTER TABLE "notification" ADD CONSTRAINT "notification_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "notification_preferences" ADD CONSTRAINT "notification_preferences_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "notification_subscription" ADD CONSTRAINT "notification_subscription_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;